hmvrulz
02-28-2007, 10:36 AM
i am writing a WAp guest book... i need help writing a script which limits 25 posts viewing per page... to view the rest.... ppl shoul use next of previous button to see the post.... but from the same php file......
i want it something like the google pages where u pres next to show the next results...
heres my php code.... for the displaying posts
<? 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_hmv22", "harsha22");
// 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\">$post_time <big>:</big> $post_creater</a><br />";
}
}
?>
<wml>
<card>
<?php echo $display_block; ?>
</card>
</wml>
you can see the page here
http://emulator.tagtag.com/wapemulator.cgi?O__SKIN=S1&wurl=www.gnuer.com/hmv/wap/show.php
i want it something like the google pages where u pres next to show the next results...
heres my php code.... for the displaying posts
<? 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_hmv22", "harsha22");
// 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\">$post_time <big>:</big> $post_creater</a><br />";
}
}
?>
<wml>
<card>
<?php echo $display_block; ?>
</card>
</wml>
you can see the page here
http://emulator.tagtag.com/wapemulator.cgi?O__SKIN=S1&wurl=www.gnuer.com/hmv/wap/show.php