Hello Friends,
I want the following issue to be resolved:
1. page results.php shows the users list (sql query results). This page also stores all user_id to an array $_SESSION. And when I click to view details of a user, user_view.php shows the details of that user.
2. I want the user details to be changed in user_view.php page when I click on (prev|next) links.
What I have achieved:
1. I am using user_view.php?prev=1 for `prev` link and user_view.php?next=1 for `next` link.
2. I am checking on top of the user_view.php page to see if $_GET or $_GET is set.
in results.php page following variables were set
$_SESSION['user_ids']=$user_ids; // $user_ids is an array with ids
$_SESSION['first_value']=reset($user_ids);
$_SESSION['last_value']=end($user_ids);
in user_view.php page following checks were being performed
$id_view=$_SESSION['user_id']; // This is to view the first user details and is set after clicking "view" for a user in results.php page
$user_ids=$_SESSION['user_ids']; // array
if (isset($_GET['prev']))
{
if ($_GET['prev'] == "1")
{
if (current($_SESSION['user_ids'])==$_SESSION['first_value'])
{
$id_view = $_SESSION['user_value'];
}
else
{
$id_view = prev($_SESSION['user_ids']);
}
}
}
if (isset($_GET['next']))
{
if ($_GET['next'] == "1")
{
if (current($_SESSION['user_ids'])==$_SESSION['last_value'])
{
$id_view = $_SESSION['user_value'];
}
else
{
$id_view = next($_SESSION['user_ids']);
}
}
}
// GET THE DETAILS OF THE USER WITH ID $id_view
$result=mysql_query("SELECT * FROM $tbl_name WHERE user_id='$id_view'",$db);
Above code is not working at all...
What I want:
Change the $id_view value when I click on prev|next links and display the details in that page.
Can you guys help me??