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 Link to comment https://forums.phpfreaks.com/topic/124211-solved-query-gets-me-resource-id6/ 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 Link to comment https://forums.phpfreaks.com/topic/124211-solved-query-gets-me-resource-id6/#findComment-641335 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? Link to comment https://forums.phpfreaks.com/topic/124211-solved-query-gets-me-resource-id6/#findComment-641367 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. Link to comment https://forums.phpfreaks.com/topic/124211-solved-query-gets-me-resource-id6/#findComment-641376 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.