Hi,
I'm a bit stuck.
I've got a table 'picture' in mysql that looks like this:
ID || imageno || filename
ID is unique and auto increment.
There are multiple rows with the same filename of a picture.
With the following script I'm trying to get all the imagenumbers (imageno) for a specific filename (in this case testpic.jpg) from the table.
I'm trying to get this result back into an array and then go through this array with a while loop, deleting one of the rows that contains the filename every time it passes through the loop.
The reason I would like to do it like this is because I need to read every imagenumber out of the array and into a new array for other operations afterwards.
The problem is that the "read into array" line only displays a value for the image number during the first iteration, but no values for the following interations.
What am I doing wrong?
$res = mysql_query("select imageno from picture where filename = 'testpic.jpg'");
$cn = 0;
while ($row=mysql_fetch_row($res))
{
$id = $row[$cn];
$idarray[$cn] = $id;
echo "read into array:".$idarray[$cn];
$cn++;
$deleteimage = mysql_query("delete from picture where filename = 'testpic.jpg");
}