View Single Post
Old 01-03-2009, 10:44 AM   #2 (permalink)
Salathe
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

Code:
  public function fetcharray()
  {
    $this->fetch = $this->query(); // Parentheses shouldn't be here
    $return = array();
    while ($field = mysql_fetch_array($this->fetch))
    {
      $return[] = $field;
    }
    return $return;
  }
The error messages itself point very clearly to the problem if you know how to decipher them. The first error says that mysql::query() was called on line 36 but you forgot to include the first argument (line 36 is: $this->fetch = $this->query();). It also tells us that mysql::query() is defined on line 25 (public function query($query)) which clearly accepts one argument.

You then get the exception because eventhough you haven't provided the SQL string to mysql::query() it'll still run. Since there's no valid SQL command passed through, mysql_query will do it's job properly allowing you to catch the problem and throw the "Unable to query" exception.

So, just remove those parentheses.
Salathe is offline  
Reply With Quote