punky79 Posted March 4, 2008 Share Posted March 4, 2008 Error in INSERT: 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 Any ideas of what this error might be. Here is my SQL code in a PHP script. $v=UPLOAD_DIR.$_SESSION['MM_Username'].'/'.$now.$_SESSION['MM_Username'].'-'.$file; //copy image to database $sql ="SELECT user_id FROM user WHERE username = '".$_SESSION['MM_Username']."'"; $queryresult = mysql_query($sql) or die (mysql_error()); if (mysql_num_rows($queryresult) > 0) { $row=mysql_fetch_assoc($queryresult); $userid=$row['user_id']; } $resins=mysql_query("INSERT INTO gallery (user_id, image_name) VALUES ($userid,'$v'") or die("Error in INSERT: ".mysql_error()); Quote Link to comment Share on other sites More sharing options...
punky79 Posted March 4, 2008 Author Share Posted March 4, 2008 Error fixed!!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.