简体   繁体   中英

What does this error mean?

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 'Resource id #2' at line 1

[Edit: following code picked out of a comment further down... indentation could be wrong]

//This is the directory where images will be saved 
$target_path = "images/";     
$target = $target_path . basename ($_FILES['photo']['name']); 
$did = $_POST['did']; 
$name = $_POST['dname']; 
$disc = $_POST['ddisc']; 
$price = $_POST['dprice']; 
$pic=($_FILES['photo']['name']); 
$con = mysql_connect("","restoraunt","123456"); 
// àéôä ùí äùøú ùìê, localhost àå îùäå? 
if (!$con) { die('Could not connect: ' . mysql_error()); } 
mysql_select_db("restoraunt", $con); 
mysql_query("INSERT INTO menu VALUES ('$did', '$name', '$disc', '$price','a','c','$pic')") ;

The fact that you're saying "near 'Resource id #2'" means that your SQL is actually the text Resource id #2 which is not a valid SQL.

I figure that you are doing this: mysql_query($someVariable) The variable that you are passing is actually an object, not a string.

There is an error in you're sql query right before Resource id #2 , mysql server can't iterpret it . Post the full query and we'll be able to tell you more about the error .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM