I want to know if it is possible to create a query where the WHERE clause have one condition but the value is an array (i.e it should see whether the row is satisfying one of the array values). It is very important that the results should be in date order (there is a correct date column). Another reason for wanting only one query is to be able to limit the results.
I am busy trying to create a timeline for statuses (like facebook’s home page, when logged in).
This is the code I have (related to this post):
//first get all friend ids of the current user using a custom function
$friendid = getfriendsid($userid);
//the user self should also appear in the timeline, add the users id to the array
$friendid = array_merge($friendid,array($userid));
//and finally the query, $friendid is array
$get = mysql_query("SELECT * FROM `status` WHERE `userid` = '$friendid' ORDER BY `date` DESC;");