Php 无法输入数据:SQL语法中有错误?检查第1行())
下面是它返回的错误:Php 无法输入数据:SQL语法中有错误?检查第1行()),php,mysql,sql,mysql-error-1064,Php,Mysql,Sql,Mysql Error 1064,下面是它返回的错误: Could not enter data: 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 '() )' at line 1 我该怎么修,这很烦人。我是MySQL和PHP编程的新手。因此,任何帮助都将不胜感激 这是我的密码: <?php $dbho
Could not enter data: 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 '() )' at line 1
我该怎么修,这很烦人。我是MySQL和PHP编程的新手。因此,任何帮助都将不胜感激
这是我的密码:
<?php
$dbhost = "localhost";
$dbuser = "root";
$dbpass = "";
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn )
{
die('Could not connect: ' . mysql_error());
}
$sql = 'INSERT INTO users '.
'(ID,Points) '.
'VALUES ( "2222", "999"() )';
mysql_select_db('database1');
$retval = mysql_query( $sql, $conn );
if(! $retval )
{
die('Could not enter data: ' . mysql_error());
}
echo "Entered data successfully\n";
mysql_close($conn);
?>
嗯,您在查询中没有看到明显的错误括号吗
$sql = 'INSERT INTO users '.
'(ID,Points) '.
'VALUES ( "2222", "999"() )';
^^^^
HERE
拆下它们。。。。f*ck。。。感谢约翰浪费你的时间。它现在工作得很好。因为,“999”(
被识别为一个函数。不要连接查询,也不要使用mysql_*API,因为它已被弃用。使用mysqli或PDO。