ID: 50259 Updated by: j...@php.net Reported By: ultrageek1 at hotmail dot com -Status: Open +Status: Bogus Bug Type: MySQL related Operating System: Linux PHP Version: 5.2.10 New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. Try var_dump() each row.. Previous Comments: ------------------------------------------------------------------------ [2009-11-21 21:05:54] ultrageek1 at hotmail dot com I loop through the data with mysql_fetch_array() not with mysql_data_seek() sorry. ------------------------------------------------------------------------ [2009-11-21 21:01:53] ultrageek1 at hotmail dot com Description: ------------ I loop through MYSQL data with a mysql_data_seek() and a while loop. and I loop through each row returned with a foreach() loop. function accepts a MYSQL resource as input ($data) along with an optional array of table headers ($head) which might only have one element. This is PHP 5.2.10, not .11 I would have to ask my hosting provider to upgrade the PHP version. no variables pass by reference. Reproduce code: --------------- <?php function build_table($data,$head = null){ echo "<table>"; if ($head){ foreach ($head as $h) echo "<th>".$h."</th>\n"; } if (is_resource($data)){ mysql_data_seek($data,0); while($row = mysql_fetch_array($data)){ echo "<tr>"; foreach($row as $cell){ echo "<td>".($cell)."</td>"; } echo "</tr>\n"; } echo "</table>\n"; } }?> Expected result: ---------------- head1 (head2 head3) r1d1 r1d2 r1d3 r1d4 r2d1 r2d2 r2d3 r2d4 r3d1 r3d2 r3d3 r3d4 .... Actual result: -------------- head1 (head2 head3) r1d1 r1d1 r1d2 r1d2 r1d3 r1d3 r1d4 r1d4 r2d1 r2d1 r2d2 r2d2 r2d3 r2d3 r2d4 r2d4 r3d1 r3d1 r3d2 r3d2 r3d3 r3d3 r3d4 r3d4 .... ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50259&edit=1