-1

Possible Duplicate:
PHP Error: mysql_fetch_array() expects parameter 1 to be resource, boolean given

I am trying to execute the php code in my localhost its running. When I transfered the same code to my host getting mysql_fetch_assoc() expects parameter 1 to be resource. Below is my code I don't know what am I really missing

   $checkQuery = "select MGUserName from MovinGalaxyLogin where MGUserName='checksan'or MGEmailID='checksan'";
   echo $checkQuery;
   $sessionUserName = mysql_query($checkQuery);

    while ($row = mysql_fetch_assoc($sessionUserName)) {
    $sessionUserName= $row["MGUserName"];
    }

Kindly Help me with this.

Thanks in Advance, Santhosh KUmar

Community
  • 1
  • 1
Santhosh Kumar
  • 170
  • 3
  • 10

1 Answers1

1

You need to see what error you're getting from MySQL. Use mysql_error() to find out.

$checkQuery = "select MGUserName from MovinGalaxyLogin where MGUserName='checksan'or MGEmailID='checksan'";
   echo $checkQuery;
   $sessionUserName = mysql_query($checkQuery);

if (mysql_error())
{
    echo mysql_error();
}
else
{
    while ($row = mysql_fetch_assoc($sessionUserName)) 
    {
        $sessionUserName= $row["MGUserName"];
    }
}
John Conde
  • 212,985
  • 98
  • 444
  • 485