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()); Link to comment https://forums.phpfreaks.com/topic/94322-php-mysql-error/ Share on other sites More sharing options...
punky79 Posted March 4, 2008 Author Share Posted March 4, 2008 Error fixed!!! Link to comment https://forums.phpfreaks.com/topic/94322-php-mysql-error/#findComment-483099 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.