Hiya,
I'm doing an admin page so people can add details of artists to a database.
Somethings the people will know the artist id number for the festival, but somethings they don't so we put temp id numbers for them on the website.
All temp numbers are above a certain number.
& we change the temp number to match the correct festival number later on. This does mean there are gaps in the numbers after a while.
Now, what I want to do is when the add an artist to the database via this admin page (done in PHP) will will find the next temp number in the sequence.
ie. Taken numbers already in the database: 400,401,402,404,405,406,455,563.
& i want the admin page to pick the next free number after 399, so in this case it would pick up 403.
does anyone know how to do this?
I've been trying to do this as:
############################################
//query the database for the next free ID Number
$artists_id_temp_countnum_start = 399;
$artists_id_temp_countnum = $artists_id_temp_countnum_start;
$artists_id_temp_num_found = false;
do
{
$artists_id_temp_countnum++;
$artists_id_temp_search = mysql_query("SELECT artist_id FROM $artists_details WHERE artist_id=".$artists_id_temp_countnum."", $conn);
if(!$artists_id_temp_search)
{
$artists_id_temp_num_found = 1;
$artists_id_temp_num = $artists_id_temp_countnum;
}
else
{
$artists_id_temp_num_found = 0;
}
}
while($artists_id_temp_num_found == 0);
echo("<p> $artists_id_temp_num</p>");
############################################
If anyone can help, that would be great.
Regards
Adam