标签: mysql-error-1064

MySQL INSERT查询

我的MySQL查询有问题:

include '../inc/mysql_config.php';
$sql="INSERT INTO ordrar 
        (id, order, namn, adress, postnummer, postort, email, status)
      VALUES
        (NULL, '$order','$namn','$adress','$postnummer', '$postort', '$email', '$email', '$status')";
 mysql_query($sql);
 if (!mysql_query($sql)) { die('Error: ' . mysql_error()); }
Run Code Online (Sandbox Code Playgroud)

这输出:

错误:SQL语法中有错误; 查看与您的MySQL服务器版本对应的手册,以便在第1行的'order,namn,adress,postnummer,postort,email,status"VALUES'附近使用正确的语法

谢谢.

解决了:

    include '../inc/mysql_config.php';
    $sql="INSERT INTO ordrar (id, substans, namn, adress, postnummer, postort, email, status)
    VALUES
    (NULL, '$substans','$namn','$adress','$postnummer', '$postort', '$email', '$status')";
    mysql_query($sql);
    if (!mysql_query($sql))
      {
      die('Error: ' . mysql_error());
      }
Run Code Online (Sandbox Code Playgroud)

感谢大家!

php mysql mysql-error-1064

-1
推荐指数
2
解决办法
408
查看次数

MySQL错误1064?

大家好,我正在尝试对我的数据库执行以下插入操作,但是每次尝试它都会失败,并且出现错误1064.我有两个双字段用于lat和long,以及一个整数id.有人能告诉我这里发生了什么吗?

INSERT INTO LatLong (lat, long) VALUES (51.53087375, -0.26259048);
Run Code Online (Sandbox Code Playgroud)

mysql sql mysql-error-1064

-1
推荐指数
1
解决办法
103
查看次数

这个简单的PHP SQL语句有什么问题?

我想用他们的全名"blo"来记录所有用户,例如:"Pablo"

我用userPHP参数传递"blo" 参数:

$q=mysql_query("select * From user Where fullName Like '%'".$_REQUEST['user']."'%'",$link );
Run Code Online (Sandbox Code Playgroud)

在php SQL语句中有些错误,因为当我在我的SQL数据库上尝试带有参数"blo"的句子时,我看到SQL语句是正确的,因为它返回了正确的结果,这是带有参数的句子"在它上面: select * From user Where fullName Like "%blo%"

我确定PHP正确接收"blo"参数,然后,它必须是PHP上SQL语句的sintax错误....但我找不到它

编辑:好的!! 最后一句话已经解决,但现在我有这个新句子有同样的问题,它有一个错误,但我不知道在哪里

$query = sprintf("SELECT u.* 
                    FROM USER u
                   WHERE u.fullName LIKE '%%%s%%' AND email NOT IN (select pp.fk_email2 from permission pp where pp.fk_email1='".mysql_escape($_REQUEST['mymail'])."') AND email NOT LIKE  '".mysql_escape($_REQUEST['mymail'])."' ",
                  mysql_real_escape_string($_REQUEST['user']));
Run Code Online (Sandbox Code Playgroud)

php mysql sql mysql-error-1064

-2
推荐指数
1
解决办法
227
查看次数

sql语法错误

您的SQL语法有错误; 检查与您的MySQL服务器版本对应的手册,以便在第1行的')'附近使用正确的语法

似乎无法解决此错误:

protected void Page_Load(object sender, EventArgs e)
{
    if (Page.IsPostBack)
    {
        //It is a postback so check if it was by div click (NOT WORKING because the javascript isnt posting back)
        string target = Request["__EVENTTARGET"];
        if (target == "DivClicked")
        {
            string id = Request["__EVENTARGUMENT"];
            //Call my delete function passing record id
            using (OdbcConnection cn = new OdbcConnection("Driver={MySQL ODBC 3.51 Driver}; Server=localhost; Database=gymwebsite2; User=root; Password=commando;"))
            {
                cn.Open();
                using (OdbcCommand cmd = new OdbcCommand("DELETE FROM WallPosting WHERE idWallPosting="+id+")", cn))
                { …
Run Code Online (Sandbox Code Playgroud)

c# mysql sql asp.net mysql-error-1064

-2
推荐指数
1
解决办法
185
查看次数

MySQL语法错误"在'desc附近使用正确的语法"

我正在使用Python并使用MySQLdb模块.我有一个工作连接(我可以成功运行其他查询)

c.execute("ALTER TABLE results ADD COLUMN desc TEXT")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/pymodules/python2.7/MySQLdb/cursors.py", line 166, in execute
    self.errorhandler(self, exc, value)
  File "/usr/lib/pymodules/python2.7/MySQLdb/connections.py", line 35,
    in defaulterrorhandler
    raise errorclass, errorvalue
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

_mysql_exceptions.ProgrammingError: (1064, "You have an error in your SQL
syntax; check the manual that corresponds to your MySQL server version for the
right syntax to use near 'desc TEXT' at line 1")
Run Code Online (Sandbox Code Playgroud)

我之前遇到过类似的麻烦; MySQLdb的语法错误消息非常不具描述性.

怎么解决这个问题?

mysql sql mysql-error-1064

-2
推荐指数
1
解决办法
529
查看次数

sql错误1064(42000)语法错误

CREATE TABLE IF NOT EXISTS message(
  id INT NOT NULL auto_increment,
  userid INT NOT NULL,
  date Date NOT NULL,
  text varchar(255) NOT NULL,
  PRIMARY KEY  ('id')
  FOREIGN KEY ('userid') REFERENCES users('id'));
Run Code Online (Sandbox Code Playgroud)

我只是想知道是否有人可以帮助我识别语法错误,因为我无法创建表.

mysql sql syntax mysql-error-1064

-2
推荐指数
1
解决办法
1万
查看次数

Mysql LIKE查询不起作用

所以我正在尝试这样的基本查询:

SELECT `City`.* FROM `city` WHERE (City 'LIKE %a%') 
Run Code Online (Sandbox Code Playgroud)

但是我得到了这个错误:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your

MySQL server version for the right syntax to use near ''LIKE %a%') LIMIT 0, 30' at line 1
Run Code Online (Sandbox Code Playgroud)

我想我错过了什么!

php mysql mysql-error-1064

-4
推荐指数
1
解决办法
595
查看次数

得到PHP错误

connection.php:

$con = mysql_connect("localhost","networka_root","secret");
if (!$con) die('Could not connect: ' . mysql_error()); 

mysql_select_db("networka_simple_login", $con);

$sql="INSERT INTO `networka` (`username`, `password`,)
             VALUES ('$_POST[username]','$_POST[password]')";

if (!mysql_query($sql, $con)) die('Error: ' . mysql_error()); 
echo "1 record added";

mysql_close($con)
Run Code Online (Sandbox Code Playgroud)

当我把我的我的错误usernamepassword:

您的SQL语法有错误; 检查与MySQL服务器版本对应的手册,以便) VALUES ('username','password')在第1行附近使用正确的语法

php mysql mysql-error-1064

-6
推荐指数
1
解决办法
49
查看次数

标签 统计

mysql ×8

mysql-error-1064 ×8

sql ×5

php ×4

asp.net ×1

c# ×1

syntax ×1