Appending numbers to unique database entries [MySQL]
Posted: Thu May 31, 2007 2:35 pm
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
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