Re: Any Ideas?
| From: | Raditha Dissanayake | Date: | Tue, 23 Mar 2004 01:07:00 +0000 |
| Subject: | Re: Any Ideas? | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-181209@lists.php.net to get a copy of this message | ||
Matthew Oatham wrote:
The idea was that the user uploads a file and I insert details about the file into the mysql table and rename the file using the generated id. Even with this scenario you probably can do with out the extra column as John has suggested.
so if the next primary key is 4 I generate the file id CR-004 and rename the uploaded file to CR-004 whilst also storing CR-004 in the table. You are still following a pattern. COuld you perhaps clarify if CR is common for all users or do you choose a different prefix for different users. If you do use different combinations of letters yes you might need a different field and then the solution would be what Robert suggested mysql_insert_id() you will need to use an update an update query where the condition has the insert id returned by this call.
Thanks for your ideas so far - very useful! How do you get to know about all these useful functions? by RTFM. :-)
Cheers Matt ------- Raditha Dissanayake. --------------------------------------------- http://www.radinks.com/print/upload.php SFTP, FTP and HTTP File Upload solutions