Counting numbers on while..

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux