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

2001-12-13 Thread +markus lervik

On Thu, 2001-12-13 at 11:42, matt stewart wrote:

> 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++).

Oh! Thanks a million! It works like a charm now.
So I guess the second alternative was right, after all.

Isn't it funny, how one can become "code-blind" regarding one
own's code?

-Markus 

-- 
Markus Lervik
Linux-administrator with a kungfoo grip
Vaasa City Library - Regional Library
[EMAIL PROTECTED]
+358-6-325 3589 / +358-40-832 6709


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




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

2001-12-13 Thread matt stewart

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:[EMAIL PROTECTED]]
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("");

for($i=0;$i<7;$i++) {
print("");
if($row[$i]=="") {
print("N/A");
}
else {
printf("%s", $row[$i]);
}
print("");
}
print("");
}

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
[EMAIL PROTECTED]
+358-6-325 3589 / +358-40-832 6709


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

---
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
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]