Javascript-php and Ajax do the paging jump, but can not come out. Look at the great God can see

Source: Internet
Author: User
Want to do an AJAX partial refresh paging jump, but do not know why Ajax-accepted data in the page
On show up always so a word mysql Errorno database selected then I did a few tests
Discover echo "111111", echo "22222", echo "3333" echo "4444"; only 4444 output! PHP I don't quite understand
So I want to trouble the great gods to see what's going on! My little brother thanked me here!


  
   
  
  " . $row [' id ']. "" . $htmlmsg. ""; } $msg = "
  
  
      " . $msg. "
"; Content for Data **echo "3333333333333333333333"; * * *---------------------------------------------*/$query _pag_num = "SELECT count (*) as COUNT from content"; $result _pag_num = mysql_query ($query _pag_num); $row = mysql_fetch_array ($result _pag_num); $count = $row [' count ']; $no _of_paginations = ceil ($count/$per _page); **echo "2222222222"; * * *---------------calculating the starting and endign values for the loop----------------------- ------------*/if ($cur _page >= 7) {$start _loop = $cur _page-3; if ($no _of_paginations > $cur _page + 3) $end _loop = $cur _page + 3; else if ($cur _page <= $no _of_paginations && $cur _page > $no _of_paginations-6) {$start _loop = $ no_of_paginations-6; $end _loop = $no _of_paginations; } else {$end _loop = $no _of_paginations; }} else {$start _loop = 1; if ($no _of_paginations > 7) $end _loop = 7; else $end _loop = $no _of_paginations; } /* ----------------------------------------------------------------------------------------------------------- * /$msg. = "
    "; For enabling the first BUTTON if ($first _btn && $cur _page > 1) {$msg. = "
  • First
  • "; } else if ($first _btn) {$msg. = "
  • First
  • "; }//For enabling the PREVIOUS BUTTON if ($previous _btn && $cur _page > 1) {$pre = $cur _page-1; $msg. = "
  • Previous
  • "; } else if ($previous _btn) {$msg. = "
  • Previous
  • "; } for ($i = $start _loop; $i <= $end _loop; $i + +) {if ($cur _page = = $i) $msg. = "
  • {$i}
  • "; else $msg. = "
  • {$i}
  • "; }//To ENABLE the NEXT BUTTON if ($next _btn && $cur _page < $no _of_paginations) {$nex = $cur _page + 1; $msg. = "
  • Next
  • "; } else if ($next _btn) {$msg. = "
  • Next
  • "; }//To ENABLE the END BUTTON if ($last _btn && $cur _page < $no _of_paginations) {$msg. = "
  • Last
  • "; } else if ($last _btn) {$msg. = "
  • Last
  • "; } $goto = " "; $total _string = " page . $cur _page. " of $no _of_paginations "; $msg = $msg. "
" . $goto. $total _string. ""; Content for pagination **echo $msg; * * **echo "1111111111111";**}?>

The above is the code

Reply content:

Want to do an AJAX partial refresh paging jump, but do not know why Ajax-accepted data in the page
On show up always so a word mysql Errorno database selected then I did a few tests
Discover echo "111111", echo "22222", echo "3333" echo "4444"; only 4444 output! PHP I don't quite understand
So I want to trouble the great gods to see what's going on! My little brother thanked me here!


  
   
  
  " . $row [' id ']. "" . $htmlmsg. ""; } $msg = "
  
  
      " . $msg. "
"; Content for Data **echo "3333333333333333333333"; * * *---------------------------------------------*/$query _pag_num = "SELECT count (*) as COUNT from content"; $result _pag_num = mysql_query ($query _pag_num); $row = mysql_fetch_array ($result _pag_num); $count = $row [' count ']; $no _of_paginations = ceil ($count/$per _page); **echo "2222222222"; * * *---------------calculating the starting and endign values for the loop----------------------- ------------*/if ($cur _page >= 7) {$start _loop = $cur _page-3; if ($no _of_paginations > $cur _page + 3) $end _loop = $cur _page + 3; else if ($cur _page <= $no _of_paginations && $cur _page > $no _of_paginations-6) {$start _loop = $ no_of_paginations-6; $end _loop = $no _of_paginations; } else {$end _loop = $no _of_paginations; }} else {$start _loop = 1; if ($no _of_paginations > 7) $end _loop = 7; else $end _loop = $no _of_paginations; } /* ----------------------------------------------------------------------------------------------------------- * /$msg. = "
    "; For enabling the first BUTTON if ($first _btn && $cur _page > 1) {$msg. = "
  • First
  • "; } else if ($first _btn) {$msg. = "
  • First
  • "; }//For enabling the PREVIOUS BUTTON if ($previous _btn && $cur _page > 1) {$pre = $cur _page-1; $msg. = "
  • Previous
  • "; } else if ($previous _btn) {$msg. = "
  • Previous
  • "; } for ($i = $start _loop; $i <= $end _loop; $i + +) {if ($cur _page = = $i) $msg. = "
  • {$i}
  • "; else $msg. = "
  • {$i}
  • "; }//To ENABLE the NEXT BUTTON if ($next _btn && $cur _page < $no _of_paginations) {$nex = $cur _page + 1; $msg. = "
  • Next
  • "; } else if ($next _btn) {$msg. = "
  • Next
  • "; }//To ENABLE the END BUTTON if ($last _btn && $cur _page < $no _of_paginations) {$msg. = "
  • Last
  • "; } else if ($last _btn) {$msg. = "
  • Last
  • "; } $goto = " "; $total _string = " page . $cur _page. " of $no _of_paginations "; $msg = $msg. "
" . $goto. $total _string. ""; Content for pagination **echo $msg; * * **echo "1111111111111";**}?>

The above is the code

Look at the document, boy. Click link
Since you are using the mysqli, the third floor is right, choose a database, mysqli is mysqli_select_db() this, link there, you see.

MySQL and mysqli mix!
It's used.$conn=mysqli_connect("localhost","root","","info");
Below withmysql_query($query_pag_data)

or change into

$conn=mysql_connect("localhost","root","","info");mysql_query($conn,"SET NAMES 'utf8'");

This error is because you did not select the database Ah, you after the connection to execute mysqli_query('use database') , database is your database, in addition, like upstairs said, do not mysqli and MySQL mixed with, PHP official has abandoned the mysql extension, with pdo ormysqli

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.