jkkenzie Posted October 31, 2008 Share Posted October 31, 2008 Hi! Is it possible to get from the database the id(if my field was id and its a PK and Auto-increment) value that is going to be used in the next record to be saved. I would like to save my image with the id as the name. This is to ensure the pictures folder where it is uploaded have unique names , and that they are not replaced by other pictures with same name. regards, Joseph Link to comment https://forums.phpfreaks.com/topic/130858-solved-get-id-from-database/ Share on other sites More sharing options...
SeanHarding Posted October 31, 2008 Share Posted October 31, 2008 You could add a time(); to your uploaded file, which would create a file with the name '1225294183_myimage.jpg' Might be an easier way of doing things. In doing so you also know when each file was uploaded. Link to comment https://forums.phpfreaks.com/topic/130858-solved-get-id-from-database/#findComment-679173 Share on other sites More sharing options...
JasonLewis Posted October 31, 2008 Share Posted October 31, 2008 Why not perform the mysql_query() first then use mysql_insert_id() to get the inserted ID. Link to comment https://forums.phpfreaks.com/topic/130858-solved-get-id-from-database/#findComment-679179 Share on other sites More sharing options...
jkkenzie Posted October 31, 2008 Author Share Posted October 31, 2008 thanks guys for your insight, I would take the first option to use time(), that would be easier and better thanks Joseph Link to comment https://forums.phpfreaks.com/topic/130858-solved-get-id-from-database/#findComment-679194 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.