Page 1 of 1

Code works fine with XAMPP but not on server

PostPosted: 17. December 2009 04:31
by FishMA
I am working on a site that uses a mysql database on remote server. I have been using xammp as a testing server and the follow code works just fine with xampp.

Code: Select all
if (isset($_SESSION['MM_Username'])){
$ID = $_SESSION['MM_Username'];
  $query  = "SELECT Email_address FROM individuals WHERE ID='$ID'" or die(mysql_error());
$result = mysql_query($query);
while($row = mysql_fetch_assoc($result)){
    $email = $row['Email_address'];
}
if (is_null($email)){
header ("Location: login_activate_warning.php");
exit;
}
}


But when I transfer everything to the server, it does not work and I receive the following error message.

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in ... on line 41.


Line 41 is:

Code: Select all
while($row = mysql_fetch_assoc($result)){


I am baffled. Any suggestions or explainations as why it works with xampp but not on the server?

Re: Code works fine with XAMPP but not on server

PostPosted: 17. December 2009 06:37
by FishMA
No need to responsed, I found my own dumb mistake.