I posted this in the PHP forum, and nobody seemed to know, so I am trying here.
I have a question about displaying database info using PHP. I am trying to display data from a database one entry at a time, but I am not able to get it to move on to the next Row. I’m not sure, but there may be a problem with my While statement as well.
This is a sample of what I have currently. I have already set up a database connection with the variable $connectionRS. The output for this code is only one row; I want it to display all of the rows (entries) in my database file.
<table>
<?php
Do {
$itemLastName = odbc_result($connectionRS, "LastName"
$itemFirstName = odbc_result($connectionRS, "FirstName"
echo "<tr> <td>{$itemLastName}</td>";
echo "<td>{$itemFirstName}</td></tr>";
} While (odbc_next_result($connectionRS));
?>
</table>
Note: I also tried copying the odbc_next_result…. statement up inside the Do braces to see if that would “move the playhead†down to the next row; didn’t work.
Thanks a ton for any comments!
Natwad
I have a question about displaying database info using PHP. I am trying to display data from a database one entry at a time, but I am not able to get it to move on to the next Row. I’m not sure, but there may be a problem with my While statement as well.
This is a sample of what I have currently. I have already set up a database connection with the variable $connectionRS. The output for this code is only one row; I want it to display all of the rows (entries) in my database file.
<table>
<?php
Do {
$itemLastName = odbc_result($connectionRS, "LastName"
$itemFirstName = odbc_result($connectionRS, "FirstName"
echo "<tr> <td>{$itemLastName}</td>";
echo "<td>{$itemFirstName}</td></tr>";
} While (odbc_next_result($connectionRS));
?>
</table>
Note: I also tried copying the odbc_next_result…. statement up inside the Do braces to see if that would “move the playhead†down to the next row; didn’t work.
Thanks a ton for any comments!
Natwad