Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jan 2007
    Posts
    137
    Thanks
    5
    Thanked 0 Times in 0 Posts

    pagination help.... second page prob

    below is the my code for showing posts from a guest book with help of pagination.... when i click the next page link it gives error

    Code:
    Parser failed. Invalid XML syntax.
    not well-formed (invalid token) at line 7, column 346, byte 479
    Click here to see the wml source
    u can see the page here

    http://www.wapsilon.com/sourceview.c...ow1.php?page=2

    well heres my php code.....
    PHP Code:
    <? header("Content-Type: text/vnd.wap.wml"); 
    echo 
    "<?xml version=\"1.0\"?>";
    echo 
    "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""
    " \"http://www.wapforum.org/DTD/wml_1.1.xml\">"?>

    <?php 

    //open connection
    $connection mysql_connect("192.168.2.7""***""***");

    // Using the database
    mysql_select_db("phpmysql_guestbook",$connection);


    // If current page number, use it 
    // if not, set one! 

    if(!isset($_GET['page'])){ 
        
    $page 1
    } else { 
        
    $page $_GET['page']; 


    // Define the number of results per page 
    $max_results 25

    // Figure out the limit for the query based 
    // on the current page number. 
    $from = (($page $max_results) - $max_results);  

    // Perform MySQL query on only the current page number's results 

    $sql mysql_query("SELECT id, name, date_format(entry_date, '%b %e') as post_time from guestbook ORDER by entry_date desc LIMIT $from, $max_results");

    while(
    $post_info mysql_fetch_array($sql)){ 
        
    // Build your formatted results here. 
        
    $post_id $post_info['id'];
    $post_creater stripslashes($post_info['name']);
    $post_time $post_info['post_time'];

    $display_block .= "<a href=\"post.php?id=$post_id\">$post_time <big>:</big> $post_creater</a><br />";
    // end for output


    // Figure out the total number of results in DB: 
    $total_results mysql_result(mysql_query("SELECT COUNT(*) as Num FROM guestbook"),0); 

    // Figure out the total number of pages. Always round up using ceil() 
    $total_pages ceil($total_results $max_results); 

    // Build Page Number Hyperlinks 

    // Build Previous Link 
    if($page 1){ 
        
    $prev = ($page 1); 
        echo 
    "<a href=\"".$_SERVER['PHP_SELF']."?page=$prev\"><<Previous</a> "



    // Build Next Link 
    if($page $total_pages){ 
        
    $next = ($page 1); 
        echo 
    "<a href=\"".$_SERVER['PHP_SELF']."?page=$next\">Next>></a>"

     
    ?> 


    <wml>
    <card>
    <?php echo $display_block?>

    </card>
    </wml>

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,642
    Thanks
    2
    Thanked 405 Times in 397 Posts
    Try using
    Code:
    &laquo;
    and
    Code:
    &raquo;
    for your left and right double-arrows.

  • #3
    Regular Coder
    Join Date
    Jan 2007
    Posts
    137
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Inigoesdr View Post
    Try using
    Code:
    &laquo;
    and
    Code:
    &raquo;
    for your left and right double-arrows.

    til today i was ignoring why the hell we need to use tht kinda codes for simple key strokes... now i learned my lesson.,

    thanx mate..


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •