RE: [PHP-DB] Problem with MySQL and array loop

From: Date: Thu, 13 Dec 2001 09:42:23 +0000
Subject: RE: [PHP-DB] Problem with MySQL and array loop
Groups: php.db 
Request: Send a blank email to php-db+get-14985@lists.php.net to get a copy of this message
you're only printing stuff while i=0, i=1,....i=6. therefore only 7 things come out. either make the loop for($i=0;$i<=7;$i++), or for($i=0;$i<8;$i++). -----Original Message----- From: +markus lervik [mailto:markus.lervik@vaasa.fi] Sent: 13 December 2001 09:37 To: php-db Subject: [PHP-DB] Problem with MySQL and array loop Hello, I've got a really strange problem. When looping through a result given by mysql_fetch_row(), the code for some reason ignores the last column in the database. The code snippet I'm using now is while($row=mysql_fetch_row($result)) { print("<TR>"); for($i=0;$i<7;$i++) { print("<TD>"); if($row[$i]=="") { print("<P ALIGN=\"CENTER\"><B>N/A</B></P>"); } else { printf("<P ALIGN=\"CENTER\">%s</P>", $row[$i]); } print("</TD>"); } print("</TR>"); } The database has got eight columns, and I can't for the world figure out why it doesn't work. I have exactly the same problem with another PHP-app that I'm developing, too, so if someone has got a solution to my problem, I'd probably get the other app working too. What is it I'm missing, or am I just stupid? I opt for the second choice. :) Cheers, Markus -- Markus Lervik Linux-administrator with a kungfoo grip Vaasa City Library - Regional Library markus.lervik@vaasa.fi +358-6-325 3589 / +358-40-832 6709 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.306 / Virus Database: 166 - Release Date: 04/12/01 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.306 / Virus Database: 166 - Release Date: 04/12/01

« previous php.db (#14985) next »