Hi, I am trying to insert an image path name into mysql. I not sure how to insert the path only if the path name "image name" does not exist. Also, I get duplicate rows when uploading image path name, not sure why. Here is some code. Any suggestions would be appreciated.

//insert image path
$insert = mysql_query("INSERT INTO mystuff.image(user_id, image_id, name)VALUES('$_POST[hiddenField]','','$file')");
echo mysql_error();

$file is the image name and the hiddenField is user_id of the logged in user.

if you don't want image path name duplication try to set the field to unique.

Thank you, I thought about that but I really don't want the column to be unique. Any other thoughts?

yeah i agree with codewall if you dont want the field to be unique then you must query it if it return 0 rows dn it doesnt exist... using mysql_num_rows to check if there are records for that path

Thanks, I found a way to get things to work with a unique col.