i program a class to query mysql and auto-paginate the data
but the server tell me the following wrong :
Fatal error: Cannot instantiate non-existent class: pagination in c:\program files\apache group\apache\htdocs\test3.php on line 5
this is my class :
class paginaiton
{ var $total_page;
var $num_perpage;
var $start_record;
var $string;
var $current_page;
var $total_record;
var $result;
var $table_flag;
var $num_rows;
var $data_array;
function set_table($flag=1)
{ $this->table_flag=$flag;
}
function set_num_perpage($num_perpage=20)
{
$this->num_perpage=$num_perpage;
}
function set_string($query_string)
{
$this->string=$query_string;
}
function query($query_string=$this->string)
{
$result=mysql_query($query_string);
$this->total_record=mysql_num_rows($result);
$this->total_page=ceil($this->total_record/$this->num_perpage);
}
function get_page($current_page=1)
{ $this->current_page=$current_page;
$this->start_record=($current_page-1)*$this->num_perpage;
$query=$this->string." limit ".$this->start_record.",".$this->num_perpage;
$this->result=mysql_query($query);
$this->num_rows=mysql_num_rows($this->result);
}
function dilplay_table()
{ if($this->table_flag)
echo "<table bgcolor=black border=0 cellpadding=4 cellspacing=1 width=100$>";
for($i=0;$i<$this->num_rows;$i++)
{ $this->data_array=mysql_fetch_array($this->result);
if($i%2)
echo "<tr bgcolor=#b3d1fd>";
else
echo "<tr bgcolor=#f4f4f4>";
while(list(,$value)=each($this->data_array))
{ echo "<td align=center>".$value."</td>";
}
echo "</tr>";
}
echo "</table>";
}
}
and i use another files to include this
require('this.inc');
$article=new pagination;//this is 5 line;