<p>
<?php
//Now we get into grabbing chat logs...
$query = mysql_db_query ($dbname,"SELECT `id`,`input`,`response` FROM `conversationlog` WHERE 1 AND `input` LIKE 'no' order by id",$db) or die (mysql_error());
?>
<table align="center" width=100% border=0 cellspacing=3 cellpadding=0>
<tr>
<td>ID</td>
<td>Input</td>
<td>Response</td>
</tr>
<?php
while ($rows = mysql_fetch_array($query)) {
echo "
<tr>
<td>$rows[id]</td>
<td>$rows[input]</td>
<td>$rows[response]</td>
</tr>";
$rows[id] = "$id";
$query2 = mysql_db_query ($dbname,"SELECT `$id-1`,`input`,`response` FROM `conversationlog` WHERE 1 AND `input` LIKE 'no' order by id",$db) or die (mysql_error());
while ($rows = mysql_fetch_array($query2)) {
echo "
<tr>
<td>$rows[id]</td>
<td>$rows[input]</td>
<td>$rows[response]</td>
</tr>";
}
}
?>
</table>
</p>
</body>
</html>
That is the mani code of what I am using to grab information from a mysql database. The script works fine, its just im stuck on how to do this part.
I want to add a fourth and fixth <td> to those that will echo back the input and response for the id before the one its calling now.
Exmaple:
It calls the id 11 with the input, no, response, no what. Then for the fourth and fixth columns I want it to echo back the id 10 (the one before) with the response and input.
Basically, it calls the id 11 data and then subtracts one and calls that data.
Could this be done, and how?
Thanks,
Neo