prima Posted January 8, 2007 Share Posted January 8, 2007 OK, i have this kind of a problem, all seems working fine but it just displays Resource id #5 an id#6 and not the number that is in the database.[quote]<?phpinclude 'connectdb.php';session_start();$regst="SELECT regst FROM number"; //in phpmyadmin it gives a number 4 that is correct, but here it doesn't$rezultat = mysql_query($regst) or die("Error no reg users") ;$onlinest="SELECT onlinest FROM number";$rezultat2 = mysql_query($onlinest) or die("Error no online users") ;echo "$rezultat "; //here should be 4echo "$rezultat2"; //here 0include 'closedb.php';?>[/quote] Link to comment https://forums.phpfreaks.com/topic/33380-solved-resource-id-5-wrong/ Share on other sites More sharing options...
kenrbnsn Posted January 8, 2007 Share Posted January 8, 2007 The mysql_query function just returns a pointer to the result set. You need to use one of the mysql_fetch functions to actually get the value(s) retrieved:[code]<?phpinclude 'connectdb.php';session_start();$regst="SELECT regst FROM number"; //in phpmyadmin it gives a number 4 that is correct, but here it doesn't$rezultat = mysql_query($regst) or die("Error no reg users") ;$rw = mysql_fetch_assoc($resultat); // inserted this statement$onlinest="SELECT onlinest FROM number";$rezultat2 = mysql_query($onlinest) or die("Error no online users") ;$rw2 = mysql_fetch_assoc($rezultat2); // inserted this statementecho $rw['regst'].'<br>'; //here should be 4echo $rw2['onlinest']; //here 0// changed the above two statementsinclude 'closedb.php';?>[/code]Ken Link to comment https://forums.phpfreaks.com/topic/33380-solved-resource-id-5-wrong/#findComment-155992 Share on other sites More sharing options...
prima Posted January 8, 2007 Author Share Posted January 8, 2007 Thanks , :D i see it now. Link to comment https://forums.phpfreaks.com/topic/33380-solved-resource-id-5-wrong/#findComment-155996 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.