hi all im looking to use a select mysql query - but im trying to query the database against a users logged in sessions. I
have the sessions working correctly but I am unsure how to included the session data in my sql select query.
here is my users session
if ($_GET['SESS_MEMBER_ID']) {
$id = $_GET['SESS_MEMBER_ID'];
} else if (isset($_SESSION['SESS_MEMBER_ID'])) {
$id = $_SESSION['SESS_MEMBER_ID'];
} else {
header("location: http://localhost/www.website.com");
exit();
}
and my session for country is the same
if ($_GET['SESS_COUNTRY']) {
$country = $_GET['SESS_COUNTRY'];
} else if (isset($_SESSION['SESS_COUNTRY'])) {
$country = $_SESSION['SESS_COUNTRY'];
} else {
header("location: http://localhost/www.website.com");
exit();
}
What I would like to do is query the database, and bring back the results where country = country - of the user who is
logged in.
so if the user(SESS_MEMBER_ID) is from the UK I would like to bring back all users from the uk ?
I am ok with querying the database but im just not sure how to include the session data ?
$sql = mysql_query("SELECT * FROM table WHERE activated='1' AND Country =$SESS_COUNTRY ORDER BY id DESC LIMIT 5");
any pointers would be very much appreciated as always