i am trying to store image in folder and 2nd part is store image name in database.
this works fine but the problem is that no matter how many images u upload, there is only one image in folder name 0.jpg.
$sql = mysql_query("SELECT * FROM item WHERE image_user_name = '$image_user_name_p'");
$existCount = mysql_num_rows($sql);
if($existCount >= 1)
{
$add_item_error .= "That image name is already taken";
exit();
}
//place image in folder
$pid = mysql_insert_id();
$image_folder_name = "$pid.jpg";
move_uploaded_file($_FILES['image_file']['tmp_name'], "IMAGE/ITEMS/$image_folder_name");
//add this product into the database now
$sql = mysql_query("INSERT INTO item (image_folder_name)
VALUES('$image_folder_name'");
i am trying to set $pid be different every time. ex 0,1,2,3,4,5....
and iam getting the id of image from database by mysql_insert_id();
so if in database image last image id is 3. than $pid = 3. this way i will get different value for pid