i have this query
$sth = $db->prepare(
'SELECT shout_id FROM shout_info'
. ' WHERE shout_location = "3"'
. ' AND (shout_sex = "0" OR shout_sex = ?)'
. ' AND (shout_age = "0" OR shout_age = ?)'
. ' AND shout_location_spec = ? AND user_id <> ?'
. ' ORDER BY date_created DESC LIMIT 15'
);
$sth->bindValue(1, $user_sex);
$sth->bindValue(2, $sql_general_age);
$sth->bindValue(3, $user_workplace);
$sth->bindValue(4, $user_id);
$sth->execute();
$workplace_array = $sth->fetchAll(PDO::FETCH_ASSOC);
Its pretty long, but i was wondering how i could also do a check from a column in another table the check would be AND shout_approved = "1" however shout_approved is in the table shout_status, the primary id for shout_status is shout_id, just like in shout_info, so i am not sure how to check this table using the same id as is being checked in the original query.
Sorry i am trying to explain as clearly as possible.
Let me know if you need anything else