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: I'm stuck

  1. #1
    New to the CF scene
    Join Date
    Apr 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    I'm stuck

    I I have been working on a script that only allows a certain amount of rows on the screen and the rest is available by a next link yet somehow it just doesnt work can anyone tell what i did wrong.
    PHP Code:
    <?php
    // verbinding met database invoegen
    include("inc_connect.php");
    //database lezen
    $pos = isset($pos) ? $pos 0;
    $count 20;
    $query "SELECT * FROM tablename ORDER BY ID ASC LIMIT $pos,$count";
    $result mysql_query($query);
    //records tellen
    $data mysql_num_rows(mysql_query("SELECT ID FROM tablename"));
    //hyperlinks aanmaken
    $next_n $pos $count;
    if(
    $next_n >= $data) {
    $next_l "volgende >>";
    } else {
    $next_l "<a href=test.php?pos=" $next_n ">volgende >></a>";
    }
    $prev_n $pos $count;
    if(
    $prev_n 0) {
    $prev_l "<< vorige";
    } else {
    $prev_l "<a href=test.php?pos=" $prev_n "><< vorige</a>";
    }
    ?>

    <html>
    <head>
        <title>Overzicht werkdagen</title>
    </head>
    <table border="1" cellpadding="2" cellspacing="2" width="90% align="center">
      <tr>
        <th scope="col">Weeknr.</th>
        <th scope="col">Datum</th>
        <th scope="col">Tijd</th>
        <th scope="col">Personeelsaam</th>
        <th scope="col">Locatie</th>
        <th scope="col">Werk</th>
        <th scope="col">Bijzonderheden</th>
      </tr>
    <?
        
    while($record mysql_fetch_object($result)) 
            {
            echo
    "
      <tr>
          
        <td><b>$record->week</b></td>
        <td><i>$record->dag $record->maand $record->jaar</i></td>
        <td>$record->begin - $record->eind</td>
        <td><b>$record->naam</b></td>
        <td>$record->locatie</td>
        <td>$record->werk</td>
        <td>$record->bijz</td>
            </tr>"
    ;
            }
    ?>
    </table>
    <center><?php echo $prev_l " " $next_l ?>
    <body>



      

     


         


    </body>
    </html>

  • #2
    Regular Coder
    Join Date
    Apr 2004
    Location
    Los Angeles
    Posts
    133
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The way you have it now $pos will always be "0". You need the line:

    $pos = $_GET['pos'];

    to grab the value from the url.

  • #3
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,273
    Thanks
    4
    Thanked 83 Times in 82 Posts
    You need to read our posting guidelines section 2

    http://www.codingforums.com/postguide.htm
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #4
    New to the CF scene
    Join Date
    Apr 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thank you that helped a lot got it working now.


  •  

    Posting Permissions

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