mattal999 Posted February 20, 2007 Share Posted February 20, 2007 hi, my mysql connects to the db fine and then selects the right row. Then when it gets to echo section, it prints the first column/value which is ID. Heres mysql table structure. ID USERNAME PASSWORD EMAIL RACE HEALTH <----- this is one i want 1 dsfasdfsdf 2 .............. 3 4 .. Here is the code for stats.php: <?php $host="sql2.ifastnet.com"; // Host name. $db_user="::you can't know! XD::"; // MySQL username. $db_password="::you can't know! XD::"; // MySQL password. $database="rpgnow_"; // Database name. mysql_connect($host,$db_user,$db_password); mysql_select_db($database); $query = "SELECT * FROM rpgusers WHERE username = '" . $_SESSION["username"] . "'";; $result = mysql_query($query); echo "<font color='ff0000' size='1' face='verdana'>Health = $result</font>"; ?> After i login as admin ( who has the user id of 3 =] )and click on status page link it says: Health = Resource id #3 please help... Quote Link to comment Share on other sites More sharing options...
Balmung-San Posted February 20, 2007 Share Posted February 20, 2007 How is this a Third Party PHP script? Either way, mysql_query returns a MySQL result resource. You want to use mysql_fetch_array() or something similar. Quote Link to comment Share on other sites More sharing options...
mattal999 Posted February 20, 2007 Author Share Posted February 20, 2007 how would i use that? i tried but it comes up with a blank page or no value where the <resource id #3> is... can you give me some code? Quote Link to comment Share on other sites More sharing options...
Balmung-San Posted February 20, 2007 Share Posted February 20, 2007 <?php mysql_connect("host","user","password"); mysql_select_db("database"); $query = "SELECT * FROM rpgusers WHERE username = '" . $_SESSION["username"] . "'";; $result = mysql_query($query); while($row = mysql_fetch_array($result)) { echo "<font color='ff0000' size='1' face='verdana'>Health = $row['Health']</font>"; } ?> Quote Link to comment Share on other sites More sharing options...
mattal999 Posted February 20, 2007 Author Share Posted February 20, 2007 now it just comes up with a completely blank white page...??? Quote Link to comment Share on other sites More sharing options...
Balmung-San Posted February 20, 2007 Share Posted February 20, 2007 Change: echo "<font color='ff0000' size='1' face='verdana'>Health = $row['Health']</font>"; To: echo "<font color='ff0000' size='1' face='verdana'>Health = ".$row['Health']."</font>"; Quote Link to comment Share on other sites More sharing options...
mattal999 Posted February 20, 2007 Author Share Posted February 20, 2007 nope, still white screen . looks like my mysql doesnt like that function... Quote Link to comment Share on other sites More sharing options...
Balmung-San Posted February 20, 2007 Share Posted February 20, 2007 Are you using the right login credentials? Also, after all the mysql_ functions, before the ; add in or die(mysql_error()) i.e.: mysql_connect("host","user","pass") or die(mysql_error()); Quote Link to comment Share on other sites More sharing options...
mattal999 Posted February 20, 2007 Author Share Posted February 20, 2007 nope its just a blank white screen... btw - im using ifastnets subdomain free hosting. if thats a problem.? 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.