View Full Version : Help for a php newbie
razor
Sat 15th Jul '00, 3:34am
Ok i was just wondering how to do something:
I would like to use a query string to separate pages, for example, same script, different page as in:
http://www.yoursite.com/script.php?action=thispage
I know how do do this in perl, how would i do it in php?
vbsquare
Sat 15th Jul '00, 7:02am
I'm far from a PHP guru, but use something like this:
<?
if ($action == "page1") {
?>
HTML Here
<?
}
if ($action == "page2") {
?>
HTML Here
<?
}
?>
Mas*Mind
Sat 15th Jul '00, 7:27am
If you mean splitting search-results or something, you can generate a mysql-query like this:
$query = "SELECT $yourfields FROM $yourtables WHERE $whereClause LIMIT $offset, $maxhits";
this will return the query result from the $offset's row until $offset+$maxhits
// do something with the query
Then you can split them by passing the offset and maxhits throught the link, something like <a href="script.php?offset=50&maxhits=20">next page</a>
razor
Sat 15th Jul '00, 12:36pm
Thanks for the help!
vBulletin® v3.8.0 Alpha 1, Copyright ©2000-2008, Jelsoft Enterprises Ltd.