Hi everyone, tried to display next and previous records using Next and Previous buttons but unable to do so. The record displayed is the current record whenever i click the Next or Previous buttons ie it doesn't move to the next or previous records. Below is the coding. Please advise. Thanks.

<form name="progress" id="progress" method="post" action=""> <td colspan="2"><input type="submit" name="prev" id="prev" value="Previous" class="btnSubmit"></td> <td colspan="2"><input type="submit" name="next" id="next" value="Next" class="btnSubmit"></td> </form>
<?php

  error_reporting(E_ALL ^ E_NOTICE);
                mysql_connect("localhost","user",""); 
                mysql_select_db("pq"); 



                $_SESSION['userid']; // it will print the userid value
                $_SESSION['username']; // it will print the userid value
                $_SESSION['usersecurity']; // it will print the userid value

                $picid = 0;  
                if(isset($_POST['next']))
                {

                   $picid=$picid++;
                   $que = mysql_query("select * from general,progress where picid ='$picid'");
                   $data = mysql_fetch_array();
                   $userid= $data["userid"]; 
                   $year= $data["year"];
                $kra= $data["kra"];
                $kpi= $data["kpi"];
                   $progress1= $data["progress1"]; 
                  $Rating1= $data["Rating1"];   
                $picid = $data["picid"];
                }
                if(isset($_POST['prev']))
                {

                   $picid=$picid--;
                   $que = mysql_query("select * from general,progress where picid ='$picid'");
                   $data = mysql_fetch_array();
                  $userid= $data["userid"]; 
                   $year= $data["year"];
                $kra= $data["kra"];
                $kpi= $data["kpi"];
                   $progress1= $data["progress1"]; 
                  $Rating1= $data["Rating1"];   
                $picid = $data["picid"];
                }
            ?>

Recommended Answers

All 2 Replies

For starters, I don't see any code where you are actually displaying something that you fetched from your database.

Sophia_1 If you want pagination or some thing else because your code not sutiable for pagination pre and next option only work through data come from data base limit option pass on sql query according to design whole arhitacture .

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.