runnerjp Posted September 14, 2008 Share Posted September 14, 2008 when i run this code to get me results in 2 colums i get the error resource id#6 <?php session_start(); require_once '../settings.php';?> <html> <table border="0" CELLSPACING="0" CELLPADDING="10" align="center"> <?php $sql = "Select * from users"; $result = mysql_query($sql) or die("Could not get threads"); $count = 1; $column = 1; //loop statement while ($myrow = mysql_fetch_array ($result)) { // first column display if ($column == 1) { //field is the column in your table printf("<tr><td>%s</td>",$myrow["username"]); } else{ //second column display printf("<td>%s</td></tr>",$myrow["email"]); } $count += 1; $column = $count % 2; } ?> </table> </html> <?php echo $result ?> resource id comes from echoing out $results as i kept getting a blank page with no errors Quote Link to comment Share on other sites More sharing options...
redarrow Posted September 14, 2008 Share Posted September 14, 2008 look up mysql_num_rows ......... what it for dont need all the lopping adding no more mate Quote Link to comment Share on other sites More sharing options...
runnerjp Posted September 14, 2008 Author Share Posted September 14, 2008 humm i had allok and im still little confused.. does my whole code need changing? Quote Link to comment Share on other sites More sharing options...
DarkWater Posted September 14, 2008 Share Posted September 14, 2008 Echoing out a MySQL connection resource simply returns its resource ID. In short, don't echo the resource, use the proper handler functions. 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.