mysql - php pagination, something is wrong -
i found tutorial according pagination. http://papermashup.com/easy-php-pagination/
i tried code , work. every time first index reload(first result in pagination).
i got message.
notice: undefined index: page in c:\xampp\htdocs\sim\registrar\index.php on line 207
how can remove message?
here's code..
$targetpage = "index.php"; $limit = 3; $query = "select count(*) num advisoryclass"; $total_pages = mysql_fetch_array(mysql_query($query)); $total_pages = $total_pages['num']; $stages = 3; $page = mysql_escape_string($_get['page']);//this part if($page){ $start = ($page - 1) * $limit; }else{ $start = 0; }
thanks
you're assuming page
set when that's not going case; hence error.
change this:
$page = mysql_escape_string($_get['page']);//this part
to:
$page = ( isset( $_get['page'] ) ) ? mysql_escape_string( $_get['page'] ) : 1;
in code above we're checking page $_get
variable has been set , using 1 fallback.
you may want @ functions you're using database too.
Comments
Post a Comment