Jump to content

MySQL database help


katarra

Recommended Posts

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("&#39;","'",$data);	
return $data;}

$data = $user;
$expgain = 1;
$expgain2 = 2;

if ($user->energy <= 0) 
{
echo "You have no energy left!" ;
exit;
}

Link to comment
https://forums.phpfreaks.com/topic/194066-mysql-database-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.