Ahoy there.
I'm having some trouble with returning a MySQL result from a class.
The error:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in ...blah blah blah
This goes three files deep, so I'll start at the top.
This is the script that is initally called:
//Load the Login class
require_once("phpClasses/Login.php");
//Instantiate a Login object
$Login = new Login;
//ERROR OCCURS HERE, so we step into that..
$Login->loginUser($_GET['username'],$_GET['pass']);
Both of those GETs are what I expect them to be.
Here is the loginUser() function in the Login object. DataConnection is an object that is loaded in the Login.php class file.
$DataConnection = new DataConnection;
$db = $DataConnection->openConnection();
//When I run this query manually, it returns the row that I want
$query = "Select password, id from userTable where uname = '".$username."'";
//This function just does a mysql_query and retuns the result
$result = $DataConnection->selectQuery($query);
//ERROR HAPPENS HERE, so we step in..
$numRows = $DataConnection->getNumberOfRows($result);
And here is the DataConnection class's getNumberOfRows() function:
//ERROR HAPPENS HERE:
function getNumberOfRows($resultSet)
{
$numRows = mysql_num_rows($resultSet);
return $numRows;
}
I'm really lost on this.
Anyhelp wpuld be great. Thanks!