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 4 of 4

Thread: php n mysql

  1. #1
    Regular Coder
    Join Date
    Jan 2007
    Posts
    137
    Thanks
    5
    Thanked 0 Times in 0 Posts

    php n mysql

    am writing a guest book for wap

    while callig the posts in the guest book
    am not able to retrive all .. am able to get only the one with id=3..
    i am sure i have missed the loop some where... am not getting it where...

    here's the 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""phpmysql_hmv""harsha");

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

    $get_posts "select id, name, date_format(entry_date, '%b %e') as post_time from guestbook order by entry_date desc";

    $get_posts_res mysql_query($get_posts,$connection) or die(mysql_error());

    // POSTS

    if (mysql_num_rows($get_posts_res) < 1) {
    // there are no posts
    $display_block "<big><b>No Records Found</b></big><br />
    <a href=\"add.php\">Click here to Sign GUEST BOOK</a>"
    ;
    } else {
    // create guestbook posts
    while ($post_info mysql_fetch_array($get_posts_res)) {
    $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\"><b>$post_time</b><big>:</big><b>$post_creater</b></a>";
    }
    }


    ?>


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

    </card>
    </wml>

    Below u can look at the Mysql... it has so many entries....
    http://www.gnuer.com/hmv/wap/retrive.php


    Code:
    CREATE TABLE guestbook (
    id INT(10) NOT NULL PRIMARY KEY  AUTO_INCREMENT,
    name VARCHAR(30) NOT NULL,
    place VARCHAR(30) NOT NULL,
    phone VARCHAR(30) NOT NULL,
    email VARCHAR(50) NOT NULL,
    message TEXT NOT NULL,
    entry_date DATETIME NOT NULL
    );

  • #2
    Regular Coder
    Join Date
    Jan 2007
    Posts
    137
    Thanks
    5
    Thanked 0 Times in 0 Posts
    u can see whts happening here....

    http://emulator.tagtag.com/wapemulat...v/wap/show.php

  • #3
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,266
    Thanks
    6
    Thanked 48 Times in 48 Posts
    PHP Code:
    } else {
    $display_block '';
    // create guestbook posts
    while ($post_info mysql_fetch_array($get_posts_res)) {
    $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\"><b>$post_time</b><big>:</big><b>$post_creater</b></a>";
    }


  • #4
    Regular Coder
    Join Date
    Jan 2007
    Posts
    137
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Nightfire View Post
    PHP Code:
    } else {
    $display_block '';
    // create guestbook posts
    while ($post_info mysql_fetch_array($get_posts_res)) {
    $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\"><b>$post_time</b><big>:</big><b>$post_creater</b></a>";
    }

    thanx sir it works..... can u tell if how to limit 20 results per page.. wht i need to do....


  •  

    Posting Permissions

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