Have an account? Sign in
Login  Register  Facebook
how to create a pagination in php problem
i get this error when i open the index.php

Notice: Use of undefined constant num - assumed 'num' in pagination.php on line 12

Notice: Undefined index: page in pagination.php on line 14

what do i do to solve this problem?
Started: September 21, 2011 Latest Activity: September 21, 2011 php pagination

please provide your code or just an example with the error line
September 21, 2011

i mean your code, your own pagination query not the function
September 21, 2011

this is your tutorial, i get those error from your tutorial i wrote the link for u
September 21, 2011

please, i mean how do you use it please let me see your code not the pagination function
September 21, 2011

i told u every thing may this help i made database tutorials and insert all SQL text on it 4.open the index.php from local host 5.everything are good except i get this error this is what you mean?
September 21, 2011

plz help me i need to fix that
September 21, 2011

1 Answer
ok, just try to replace with this
    $query = \"SELECT COUNT(*) as num FROM $tbl_name\";
    $row = mysql_fetch_array(mysql_query($query));
    $total_pages = $row[\'num\'];
and replace
    $page = $_GET[\'page\'];
with
    $page = (int) (!isset($_GET[\"page\"]) ? 1 : $_GET[\"page\"]);
    $page = ($page == 0 ? 1 : $page);

Posted: MacOS
In: September 21, 2011

tnx one error solved but error in line 14 not solved still i get this Notice: Undefined index: page pagination.php on line 14
September 21, 2011

try part 2 of the code please
September 21, 2011

thank u very very much to share your knowledge to others
September 21, 2011

thanks, any peoblem just let me see it :)
September 21, 2011

Your Answer

xDo you want to answer this question? Please login or create an account to post your answer