I can get the ID just after INSERT by mysql_insert_id(); but I want to save an image in the form of ID-image_name.jpg and save it in a column named Image_Name. How can I save the image with forthcoming ID? Or it is better to save the image file after INSERT process?
Share
Yes, it is better to save the image after the INSERT. You’ll want to undo the INSERT (either using DELETE or rolling back the transaction) if saving the file fails of course. If you use a standard naming scheme then you won’t have to touch the database again to set the filename in the table (because there wouldn’t need to be a filename in the table).