Reply to Counting numbers on while..

Your name:

Reply:


Posted by Louie Miranda on 03/28/05 11:05

Hi, im trying to create a number loop on a table where the data came
in a database.

I have tried the for "loop" and counted $countCards_result from the
table where im going to get all the data.

## code ##
while ($profile->fetchInto($row)) {

for ($i = 1; $i <= $countCards_result; $i++) {
$num = $i;

print("
<tr>
<td>$num</td>
<td>" .$row[2]. "</td>
</tr>
");

} // end of for loop
} // end of while
## code ##

Well, it did loop the numbers from what did came out of
$countCards_result but, the results are wrong because it loops each
row from 1 to 10.

Here's the example:

1 louie edit | delete
2 louie edit | delete
3 louie edit | delete
4 louie edit | delete
5 louie edit | delete
6 louie edit | delete
7 louie edit | delete
8 louie edit | delete
9 louie edit | delete
10 louie edit | delete
1 miranda edit | delete
2 miranda edit | delete
3 miranda edit | delete
4 miranda edit | delete
5 miranda edit | delete
6 miranda edit | delete
7 miranda edit | delete
8 miranda edit | delete
9 miranda edit | delete
10 miranda edit | delete

And so on..

What i wanted it to do was..

1 louie edit | delete
2 miranda edit | delete

And so on..

I was wondering how can i get it to count only the rows, and dont
repeat from 1 to 10 on all rows.

Please help!

--
Louie Miranda
http://www.axishift.com

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация