I want to loop through results with a while statement without having to do another SQL statement. Here is my example.
----------------------------------
$sql_statement = "SELECT id, price, title, date, FROM table where date = \"2004/12/7\"";
$result = mysql_query($sql_statement) or die(mysql_error());
while($abc = mysql_fetch_array( $result ))
{
$id = $abcd[0];
$price = $abc[1];
$title = $abc[2];
$date = $abc2[3];
echo "$title";
}
// I want to run another while statement here
while($bob2 = mysql_fetch_array( $result ))
{
echo "Now I will list $id";
}
------------------------------------
Let's say I run a SQL statement to pull pictures and titles of movies from a data base. I want the pictures to cycle through first with a while statement. When all the pictures cycle through I want to list the titles with price or whatever afterward (IE: Now I will list $id from above). I don't want to have another SQL statement if possible. Does anyone know if this is possible and how it can be done?
Thanks
Dean
----------------------------------
$sql_statement = "SELECT id, price, title, date, FROM table where date = \"2004/12/7\"";
$result = mysql_query($sql_statement) or die(mysql_error());
while($abc = mysql_fetch_array( $result ))
{
$id = $abcd[0];
$price = $abc[1];
$title = $abc[2];
$date = $abc2[3];
echo "$title";
}
// I want to run another while statement here
while($bob2 = mysql_fetch_array( $result ))
{
echo "Now I will list $id";
}
------------------------------------
Let's say I run a SQL statement to pull pictures and titles of movies from a data base. I want the pictures to cycle through first with a while statement. When all the pictures cycle through I want to list the titles with price or whatever afterward (IE: Now I will list $id from above). I don't want to have another SQL statement if possible. Does anyone know if this is possible and how it can be done?
Thanks
Dean