katarra Posted March 3, 2010 Share Posted March 3, 2010 I'm having a problem with the result coming up as 0 so it just says I have "no energy left", which isn't the case. Here's the part of the code that isn't working right. Any help would be AWESOME! Thanks! <?php function fish($username){ $data = ""; $dbh=dbconnect() or die ('Fish error: ' . mysql_error()."<br>"); mysql_select_db("katarra_game"); $result = mysql_query("SELECT * FROM users WHERE username = '$username'"); if (mysql_num_rows($result) > 0) $data = stripslashes(mysql_result($result,0,$var)); mysql_close($dbh); $data = str_replace("'","'",$data); return $data;} $data = $user; $expgain = 1; $expgain2 = 2; if ($user->energy <= 0) { echo "You have no energy left!" ; exit; } Quote Link to comment https://forums.phpfreaks.com/topic/194066-mysql-database-help/ Share on other sites More sharing options...
mapleleaf Posted March 4, 2010 Share Posted March 4, 2010 Have you echoed out $data to see what you get? Quote Link to comment https://forums.phpfreaks.com/topic/194066-mysql-database-help/#findComment-1021224 Share on other sites More sharing options...
katarra Posted March 4, 2010 Author Share Posted March 4, 2010 Yeah, it comes back as just a blank screen, so it's not pulling anything. Quote Link to comment https://forums.phpfreaks.com/topic/194066-mysql-database-help/#findComment-1021363 Share on other sites More sharing options...
fenway Posted March 4, 2010 Share Posted March 4, 2010 Yeah, it comes back as just a blank screen, so it's not pulling anything. Blank screen = PHP error == wrong forum. Quote Link to comment https://forums.phpfreaks.com/topic/194066-mysql-database-help/#findComment-1021467 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.