Hi everyone, am trying to display the next record with next button and previous record with previous button from 2 tables. But when i click next there is no record displayed eventhough there are records in the database. The same thing happens with previous button. Please advise. Thanks a lot.
<?php
error_reporting(E_ALL ^ E_NOTICE);
mysql_connect("localhost","user","");
mysql_select_db("pq");
$_SESSION['userid']; // it will print the userid value
if(isset($_GET['picid']) && (int)$_GET['picid']) $picid = $_GET['picid'];
else $picid = 1;
$_SESSION['kra'];
$_SESSION['kpi'];
$query = "SELECT * from ipd where userid='".$_SESSION['userid']."' and picid= '$picid' LIMIT 1";
$result = mysql_query($query);
if($num=mysql_numrows($result)) {
$record = mysql_fetch_assoc($result);
$userid= $record["userid"];
$kra= $record["kra"];
$kpi= $record["kpi"];
$picid = $record["picid"];
}
$query = "SELECT * from progress WHERE picid= '$picid' and userid='". $_SESSION['userid']."' LIMIT 1";
$result = mysql_query($query);
if($num=mysql_numrows($result)) {
$record = mysql_fetch_assoc($result);
$progress1= $record["progress1"];
$progress2= $record["progress2"];
$progress3= $record["progress3"];
$progress4= $record["progress4"];
$picid = $record["picid"];
}
$picid = $_GET['picid'];
$next = $picid + 1;
$prev = $picid - 1;
?>