Forum Moderators: coopster
Im getting the following error in a script..
Error #2: 'mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given' in C:\xampp\htdocs\links\databases\mysqli.php on line 42
line 42 is:
function numrows($q) { return mysqli_num_rows($q); }
The bigger part is:
function query($query)
{
global $debug, $debuginfo, $querycount;
$querycount++;
if ($debug == 1) echo "<p><b>Query $querycount:</b> $query</p>";
else $debuginfo .= "<p><b>Query $querycount:</b> $query</p>";
return mysqli_query($this->dbh, $query);
}
function error() { return mysqli_error($this->dbh); }
function numrows($q) { return mysqli_num_rows($q); }
function lastid() { return mysqli_insert_id($this->dbh); }
function numfields($result) { return mysqli_num_fields($result); }
function row($result) { return mysqli_fetch_row($result); }
function fieldname($q1, $b) { return $this->fetchcolumn($q1, $b); }
function fieldtype($q1, $b) { $o = mysqli_fetch_field_direct($q1, $b); return typenumbertoname($o->type); }
function fieldlength($q1, $b) { $o = mysqli_fetch_field_direct($q1, $b); return $o->length; }
function fetcharray($result) { return mysqli_fetch_array($result); }
function fetchassoc($result) { return mysqli_fetch_assoc($result); }
function fetchcolumn($result, $column)
can someone please explain what this means ?
Thank you..
mysqli_query(): Returns TRUE on success or FALSE on failure. For SELECT, SHOW, DESCRIBE or EXPLAIN mysqli_query() will return a result object.
If you are useing 'INSERT, UPDATE, DELETE' ect you will get TRUE or FALSE returend depending if it was sucessfull, not a result object.
Read up on it here: [uk3.php.net...]