Welcome Guest, Not a member yet? Register   Sign In
Count_ALL error table and num_rows.
#1

[eluser]Unknown[/eluser]
This is necessary?

Original Code:
Code:
/**
  * "Count All" query
  *
  * Generates a platform-specific query string that counts all records in
  * the specified database
  *
  * @access public
  * @param string
  * @return string
  */
function count_all($table = '')
{
  if ($table == '')
  {
   return 0;
  }

  $query = $this->query($this->_count_string . $this->_protect_identifiers('numrows') . " FROM " . $this->_protect_identifiers($table, TRUE, NULL, FALSE));

  if ($query->num_rows() == 0)
  {
   return 0;
  }

  $row = $query->row();
  return (int) $row->numrows;
}

Change code:

Code:
/**
  * "Count All" query
  *
  * Generates a platform-specific query string that counts all records in
  * the specified database
  *
  * @access public
  * @param string
  * @return string
  */
function count_all($table = '')
{
  if ($table == '')
  {
   return 0;
  }

  $query = $this->query($this->_count_string . $this->_protect_identifiers('numrows') . " FROM " . $this->_protect_identifiers($table, TRUE, NULL, FALSE));
  
  if(count($this->_error_message()) == 0){
   if ($query->num_rows() == 0)
   {
    return 0;
   }
  
   $row = $query->row();
   return (int) $row->numrows;
  }
}




Theme © iAndrew 2016 - Forum software by © MyBB