The real problem you're having is the statement says "while there are
results in this query, grab them" - once you reach the end of the first
while loop, there are no more results, so the second one is skipped
right over - it's condition *never* evaluates true.

If the query isn't changing, and there aren't other conditions/etc. -
then just grab all the data the first time through and put it where it
needs to go.

$array_stuff = array();
$line = 0;

while (mysql_fetch_array($result) as $row1) {
    // data for first set of operation(s)
    $crab = $row1["bar"];
    // data for second set of operation(s)
    $array_stuff[$line] = array()
    $array_stuff[$line]["foo"] = $row1["foo"];
    $array_stuff[$line]["bar"] = print $row1["bar"];
    $array_stuff[$line]["steak"] = print $row1["steak"];
    // increment $line?
    // $line++;
}

... You'll want to be incrementing $line somewhere though, unless you
just want to keep overwriting $array_stuff[0]

Another solution to this type of problem is to just read all the
information into an array, then loop through that when you need it.
E.G.

$resultset = array();
while (mysql_fetch_array($result) as $row) {
        $resultset[] = $row;
}

Then just

foreach ($resultset as $row) { // or ($resultset as $rownum => $row)
        // ... do stuff
}


Happy hunting.

- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to