hi, does anyone have any experience with pear db using mysql? i would like to know how to get the number of rows returned by a resultset! there are two functions: numCols and numRows in the class for postgres, but only numCols for mysql!

When I try to write my own function for numRows as follows:

function numRows($result) 
{
	$rows = mysql_num_rows($result);
	if (!$rows) 
    {
		return $this->raiseError($this->errorCode(mysql_errno($this->connection)));
	}
	return $rows;
}

..this does not work.

please help! how can i check for the no or rows returned?

    winnie,

    same problem. i think u should try getting hold of a recent version of mysql.php. it should have the numRows() in it. look for "pear php cvs" on yahoo or something..while u are at it, take a look at the latest DB.php as well as COMMON.php...

    trust me, u are among the many who desparately want pear to be released "properly", but that's in the works..

    shanx

      I use this in my abstraction file without problem.

      function num_rows($result){
      $num = mysql_num_rows ($result);
      return $num;
      }

      You said that the code you supplied doesnt work, what error does it generate?

        Write a Reply...