Thread: num rows
View Single Post
Old 02-26-2011, 06:38 AM   #1 (permalink)
Keinstah
The Visitor
 
Keinstah's Avatar
 
Join Date: Feb 2011
Posts: 2
Thanks: 0
Keinstah is on a distinguished road
Default num rows

hello im new here and im getting this error
Fatal error: Call to a member function execute() on a non-object in PATH......

im using this class to get the num rows please correct me
PHP Code:
public function prepareDB($query NULL) {
        
$prepare $this->mysqli->prepare($query);
        return 
$prepare;
        }
    
    public function 
numDB($query NULL) {
        
$this->stmt $this->prepareDB($query);
        
$this->stmt->execute();
        
$this->stmt->store_result();
        
$num $this->stmt->num_rows;
        
$this->stmt->close();
        return 
$num;
        } 
PHP Code:
$query "SELECT * WHERE smthng='value'";
$num $Database->numDB($query);

echo 
$num
thx.
Keinstah is offline  
Reply With Quote