i have the following code :
<?php
include("connect.php");

$query=("SELECT `uid` FROM `lagina` . `users`");
$select=mysql_query($query);
$row=mysql_fetch_array($select);
$id=$row[uid];


if (isset($_POST['next'])) {
	$query_1=("SELECT `uid` FROM `lagina` . `users` WHERE `uid` > $id");
$select_1=mysql_query($query_1);
$row_1=mysql_fetch_array($select_1);
$id_1=$row_1[uid];

}

?>
<html>
<form action="test.php" method="POST">
<input type="submit" name="prev" value="pre">
<input type="submit" name="next" value="next">
<input type="hidden" name="pro" value="1">

</form>
</html>
all i need is each time i click next i go to the next uid and each time i click prev i go to the perv record so any body can help ?

    this is not a complete answer, but I like your code for the $_POST['next'] portion. i would start by making one change, however. you have:

    "SELECT uid FROM lagina . users WHERE uid > $id"

    I would add:

    "SELECT uid FROM lagina . users WHERE uid > $id LIMIT 1"

    This will give you only one result, which is what I think you're looking for anyway. And instead of using mysql_fetch_array to get the results, use mysql_result(select_1,0,'uid')

      okay let me simplify my question more
      its like
      you have the following code and eah time u click next it inc the result by 1
      <?

      $id='1';
      if ($POST['process']==1 && isset($POST['next'])) {
      $id=$id+1;
      }
      echo $id;

      ?>
      <html>
      <form action="test.php" method="POST">
      <input type="hidden" name="process" value="1";>
      <input type="submit" name="next" value="next">
      </form>
      </html>
      this is not working what i need as a explain eah time $_post['next']
      the $id increse by 1
      it only works one one time only
      i geuss that it should works in two pages using a session to pass the variable $id is that true ??????????????

        Heres an simplified version of next prev(I was bored 🙂 ) Didnt test it with database so hopefully theres not too much errors 🙂

        <?php
        /* Put mysql connection code here */
        
        
        if (isset($_POST['id'])) {
            $tmp = array_keys($_POST['id']);
            $curid = intval($tmp[0]);
        
        // Select contents from the selected id
        $sql = "SELECT field1,field2,field3 FROM table WHERE id={$curid}";
        $result = mysql_query($sql);
        if (mysql_num_rows($result)>0) {
            $info = mysql_fetch_assoc($result);
        } else {
            die('Not found');
        }
        
        // Next id
        $sql = "SELECT id FROM table WHERE id>{$curid} LIMIT 1";
        $result = mysql_query($sql);
        if (mysql_num_rows($result)>0) {
            $nextid = mysql_result($result,0);
        }
        
        // Prev id
        $sql = "SELECT id FROM table WHERE id<{$curid} LIMIT 1";
        $result = mysql_query($sql);
        if (mysql_num_rows($result)>0) {
            $previd = mysql_result($result,0);
        }
        } else {
            // No form has been submitted so use the lowest id and grab its info
            $sql = "SELECT field1,field2,field3 FROM table WHERE id > 0 LIMIT 1";
            $result = mysql_query($sql);
            if (mysql_num_rows($result)>0) {
                $info = mysql_fetch_assoc($result);
            }
        }
        
        if (isset($info)) {
            $content = '<pre>'.print_r($info,true).'</pre>';
        } else {
            $content =  'Nothing in the db :(';
        }
        ?>
        <html>
        <head>
        <title>Next prev</title>
        </head>
        <body>
        <h3>Info</h3>
        <?php echo $content; ?>
        <form method="post">
        <?php if (isset($previd)) { ?>
        <input type="submit" name="id[<?php echo $previd?>]" value="prev">
        <?php } ?>
        <?php if (isset($nextid)) { ?>
        <input type="submit" name="id[<?php echo $nextid?>]" value="next">
        <?php } ?>
        </form>
        </body>
        </html>
        

          i found what am looking for check this out

          <?php
          // database connection stuff here
          if (!isset($screen))
          $screen = 0;
          $start = $screen * $rows_per_page;
          $sql = "SELECT description FROM table_name ";
          $sql .= "LIMIT $start, $rows_per_page";
          $result = mysql_query($sql, $db);
          $rows = mysql_num_rows($result);
          for ($i = 0; $i < $rows; $i++) {
          $description = mysql_result($result, $i, 0);
          echo "\$description = $description<br>\n";
          }
          echo "<p><hr></p>\n";
          // let's create the dynamic links now
          if ($screen > 0) {
          $url = "example.php?screen=" . $screen - 1;
          echo "<a href=\"$url\">Previous</a>\n";
          }
          // page numbering links now
          for ($i = 0; $i < $pages; $i++) {
          $url = "example.php?screen=" . $i;
          echo " | <a href=\"$url\">$i</a> | ";
          }
          if ($screen < $pages) {
          $url = "example.php?screen=" . $screen + 1;
          echo "<a href=\"$url\">Next</a>\n";
          }
          ?>

            Write a Reply...