I'm getting the error:
Warning: Wrong parameter count for mysql_error() in the following code at line in bold (first one) and
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource at the line in bold (second occurence).
Any help please?
Quote:
function & getData($sql)
{
$this->data_array = array();
$pageno= $this->pageno;
$rows_per_page = $this->rows_per_page;
$this->lastpage = 0;
if ($pageno == '' || $pageno <= '1')
$pageno = 1;
$sql = $sql;
$result = mysql_query($sql, $this->db) or mysql_error("SQL", E_USER_ERROR);
if( strtolower($this->paging_require) =="yes")
{
if ($rows_per_page > 0)
$limit_str = "LIMIT " .($pageno - 1) * $rows_per_page ."," .$rows_per_page;
else
$limit_str = NULL;
}
if($result && mysql_num_rows($result))
{
$this->total_rows=mysql_num_rows($result);
}
else
$this->total_rows=0;
if( strtolower($this->paging_require) =="yes")
{
$query_sql ="$sql $limit_str";
$result=mysql_query($query_sql, $this->db);
}
if(mysql_num_rows($result) <= 0)
{
$this->pageno =1;
$this->total_page=1;
$error_msg=$this->errors;
return 0;
}
else
{
if ($rows_per_page > 0 && strtolower($this->paging_require) =="yes")
$this->total_page = ceil($this->total_rows/$rows_per_page);
else
$this->total_page = 1;
$this->last_page =$this->total_page;
$query_data = mysql_fetch_row($result);
if ($pageno > $this->last_page)
$pageno = $this->last_page;
$this->pageno = $pageno;
mysql_data_seek($result, 0);
while ($row = mysql_fetch_assoc($result))
{
$this->data_array[] = $row;
}
mysql_free_result($result);
return $this->data_array;
}
}
|
Deep