Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

This is likely an easy one...

Status
Not open for further replies.

frozenpeas

Technical User
Sep 13, 2001
893
CA
I have narrowed my problem down to the following: this chunk of code isn't generating any of the table rows or data. Can anyone see what the problem is? Thanks.

Code:
while ($num >= $cur) {

$row = mysql_fetch_array($result);

$quantity = $row["quantity"];
$item = $row["item"];
$condition = $row["condition"];
$price = $row["price"];
$misc = $row["misc"];
$year = $row["year"];

echo &quot;<tr>&quot;;
echo &quot;<td><font face=\&quot;Verdana, Arial, Helvetica, sans-serif\&quot; size=\&quot;2\&quot; color=\&quot;#FFFFFF\&quot;>$quantity</font></td>&quot;;
echo &quot;<td><font face=\&quot;Verdana, Arial, Helvetica, sans-serif\&quot; size=\&quot;2\&quot; color=\&quot;#FFFFFF\&quot;>$item</font></td>&quot;;
echo &quot;<td><font face=\&quot;Verdana, Arial, Helvetica, sans-serif\&quot; size=\&quot;2\&quot; color=\&quot;#FFFFFF\&quot;>$condition</font></td>&quot;;
echo &quot;<td><font face=\&quot;Verdana, Arial, Helvetica, sans-serif\&quot; size=\&quot;2\&quot; color=\&quot;#FFFFFF\&quot;>$price</font></td>&quot;;
echo &quot;<td><font face=\&quot;Verdana, Arial, Helvetica, sans-serif\&quot; size=\&quot;2\&quot; color=\&quot;#FFFFFF\&quot;>$misc</font></td>&quot;;
echo &quot;<td><font face=\&quot;Verdana, Arial, Helvetica, sans-serif\&quot; size=\&quot;2\&quot; color=\&quot;#FFFFFF\&quot;>$year</font></td>&quot;;
echo &quot;</tr>&quot;;
$cur++;
}
?>

Thanks again.
 
You're expecting associative arrays where PHP is providing numerically indexed arrays.

Have you tried

mysql_fetch_array ($result, MYSQL_ASSOC)

or

mysql_fetch_assoc ($result)

______________________________________________________________________
TANSTAAFL!
 
why you do that while?

just do

while ($row = mysql_fetch_array($result)){

instead.

if this won't solve your problem, check the query you are doing.

another thing to do is, for debugging purposes only, change the border of the table to 5 and check if it draws a table with the correct number of rows.

Anikin
Hugo Alexandre Dias
Web-Programmer
anikin_jedi@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top