I have a multidimension array, which is just a result set from a mysql query, that I'm looping through. How do I get data out of an iteration that has already been passed in the loop? I'm trying to do this
or the same type of thing without a loop would be:
| Code: |
|
$result = mysql_query("SELECT id,date from mytable"); $n = mysql_num_rows($result); //returns 6 rows $count = 0; while($row = mysql_fetch_array($result, MYSQL_ASSOC) { echo $row[$count-1]['date']; //this should return the date from the previous row }//end for loop |
or the same type of thing without a loop would be:
| Code: |
|
$result = mysql_query("SELECT id,date from mytable"); $n = mysql_num_rows($result); //returns 6 rows $row = mysql_fetch_array($result); echo $row[3]['date']; //should show the date for row 3 in db |
