jjacquay712 Posted December 2, 2008 Share Posted December 2, 2008 im using this code to echo a database table into an html table. it works, but it echos out 7x as many columns as i need, its hard to explain, so heres a demo: http://johnj.gknu.com/post.php Here is my Code: <table width="200" border="1"> <?php mysql_connect(hidden); mysql_select_db(hidden); $query = mysql_query("SELECT * FROM comments"); $query1 = mysql_query("SELECT * FROM comments"); echo '<tr>'; while ($array1 = mysql_fetch_array($query1)) { foreach ($array1 as $value1 => $lol1) { if ( !is_int($value1) ) { echo '<td>' . $value1 . '</td>'; } } } echo '</tr>'; while ($array = mysql_fetch_array($query)){ echo '<tr>'; foreach ($array as $value => $lol) { if ( !is_int($value) ) { echo '<td>' . $lol . '</td>'; } } echo '</tr>'; } ?> </table> any reasons it might be doing this? Thanks, John Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.