Hi,
I am running a loop where for each iteration, I run a select query in mysql where (mysql variable) = $i. The problem I am having is that the query name is the same each time, and for whatever reason I am getting the correct number of rows in my loop, but they are all processing the same query (the first one, where $i=1) instead of doing a different query.
Hence, I get $i number of rows, but the same results on each line.
Is there a way to reset the query results so I can use the same query name each time, or is there a way to set a dynamic name for each query?
Any help would be much appreciated.
Code looks something like this:
$i=1;
while ($i<$col_num)
{
$query = "SELECT * from pboard WHERE list_cat=$i";
$result2 = mysql_query($query);
while ($row=mysql_fetch_array($result))
{
$data[]= $row['title'];
}
$i++;
}
Thanks,
Siobahn