This is a discussion on Why Does Foreach Display Each Loop Twice within the PHP Programming forums, part of the Web Development category; //this loop doesnt work as intended, each row displays twice, once with a number as $key and again with key ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
#1
| |||
| |||
| //this loop doesnt work as intended, each row displays twice, once with a number as $key and again with key name as $key!? Any ideas why? $result = mysql_query("SELECT * FROM tbl WHERE id = Ƈ' "); while($row = mysql_fetch_array($result)) { foreach ($row as $key =$value) { echo "<tr><td style='width:150px'>$key</td><td>$value</td></tr>"; } |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Sql loop Statement | shaalini | Database Support | 17 | 12-15-2008 10:46 PM |
| Loop in Mysql | Murali | Database Support | 0 | 02-12-2008 05:37 AM |
| Which is faster for array, while or for or foreach ? | vivekanandan | PHP Programming | 1 | 07-20-2007 06:15 AM |
| Difference in for & foreach, exec | vadivelanvaidyanathan | Perl | 0 | 07-15-2007 06:16 PM |
| Javaa:Tutorial - The Loop | pranky | Java Programming | 0 | 02-23-2007 11:58 PM |
Our Partners |