Page is a not externally linkable
skoff - 1:43 pm on Jan 8, 2013 (gmt 0)
First thing, forget the do while thing.. to pass through all records in your query you should use :
while($row = mysql_fetch_array($result)) {
}
and for what your trying to attempt, your best bet would be to put it in a temp variable. Set it with the $id at the end of the loop. So when the loop will pass to the second records and all others after it will still have the value of the previous $id. I dont know what you did want to do with the first record because there would be no "previous" id so this is the reason of the if/else i put.
$x = 0;
while($row = mysql_fetch_array($result)) {
$id = $row['ID'];
$text = $row['text'];`
echo "<tr>
<td>Here is the text - " . $text . "</td>
<td>The ID of the text is - " . $ID . "</td>
if($x !== 0) {
<td>The ID of the previous entry is - " . $x? . "</td>
}
else {
<td> </td>
}
</tr> ";
$x = $row['ID'];
}
hope this helps!