Troubleshooting mysql_fetch_array - I'm stumped!
| From: | Michael Stembridge | Date: | Wed, 09 Aug 2000 04:56:04 +0000 |
| Subject: | Troubleshooting mysql_fetch_array - I'm stumped! | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-10819@lists.php.net to get a copy of this message | ||
See sample code below, or click here for a text version:
http://www.georgiaoffroad.com/sample.txt
As it stands, the fist row (Version) prints to the screen (data from the
'techman' database, that is); every row thereafter is blank.
(on a side, there are 2 matches for the 'EAGLE' criteria, each match has
it's own column.)
Do I need to make a seperate query for each row of data? It seems like php
is releassing the data from the buffer after printing the first row. There
are no script errors.
I appreciate your help.
## Sample code ##
<html> html code blablah
<?php
$db = mysql_connect("localhost","office","website");
mysql_select_db("techman",$db);
$result = mysql_query("SELECT * FROM ver WHERE pmsid='EAGLE'",$db);
?>
<table width="700" border="0" cellpadding="5"
cellspacing="0">
<tr>
<td bgcolor=325f61><p class="bold2">Version</p></td>
<?php
do {
echo "<td bgcolor=325f61><p class=\"bold2\">";
printf("%s", $myrow["ver"]);
echo "</p></td>\n";
} while ($myrow = mysql_fetch_array($result));
?> </tr>
<tr>
<td bgcolor=325f61><p class="bold2">Interface:</p></td>
<?php
do {
echo "<td bgcolor=325f61><p>";
printf("%s", $myrow["interface"]);
echo "</p></td>\n";
} while ($myrow = mysql_fetch_array($result));
?> </tr>
<tr>
<td bgcolor=325f61><p class="bold2">Acme path:</p></td>
<?php
do {
echo "<td bgcolor=325f61><p>";
printf("%s", $myrow["installdir"]);
echo "</p></td>\n";
} while ($myrow = mysql_fetch_array($result));
?> </tr>
</td></tr></table>
html code blablah
</html>