Announcement

Collapse
No announcement yet.

Help for a php newbie

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help for a php newbie

    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?

  • #2
    I'm far from a PHP guru, but use something like this:

    <?
    if ($action == "page1") {
    ?>
    HTML Here

    <?
    }

    if ($action == "page2") {
    ?>
    HTML Here

    <?
    }
    ?>

    Comment


    • #3
      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>

      Comment


      • #4
        Thanks for the help!

        Comment

        Loading...
        Working...
        X