Using a MySQL database I am adding file names and extensions into the database. There is a problem I am having though. The file names column is set to unique but I would like to use a php script to check if the file name is already there and if so append the next greatest number onto the end so that it will not return an error because a file name is already there. The next time the file was uploaded it would check for the file name, and upon finding both 'test' and 'test1' it would append a 2 to the file name making a 'test2'.
I am just starting with MySQL/PHP together so I don't know very many commands so any in depth explanations would be extremely useful.
Thanks
Appending numbers to unique database entries [MySQL]
Moderator: General Moderators
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm