Originally posted by ronverdonk
[PHP]$v=UPLOAD_DIR.$ _SESSION['MM_Username'].'/'.$now.$_SESSIO N['MM_Username'].'-'.$file;
//copy image to database
$sql ="SELECT user_id FROM user WHERE username = '".$_SESSION['MM_Username']."'";
$queryresult = mysql_query($sq l)
or die (mysql_error()) ;
if (mysql_num_rows ($queryresult) > 0) {
$row=mysql_fetc h_assoc($queryr esult);
$userid=$row['user_id'];
}
$resins=mysql_q uery("INSERT INTO gallery (user_id, image_name) VALUES ($userid,'$v'")
or die("Error in INSERT: ".mysql_error() );[/PHP]
When I upload a file and it tries to send it to the database I get this error message:
"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"
Comment