can't get mysql_num_rows to work

admin

Administrator
Staff member
From looking through the forum, this seems to be a pretty common problem. I know I must be doing something wrong. My code is:


// set up and perform query; return category name
$sql = "SELECT CatName
FROM $this->CAT_TBL
WHERE CatID = $catID";
$results = $this->ajwSQLSelect($sql);
if (mysql_num_rows($results) > 0)
{
$results = $results[0]["CatName"];
}
return $results;


The 'if' statement always fails, even though a result is returned. The only way I've gotten it to work is without mysql_num_rows, such as:

if (!empty($results))


Any ideas what I'm doing wrong?

Thanks,

A.J. Wilson
 
Back
Top