jaymc Posted June 5, 2007 Share Posted June 5, 2007 I have a database which has a mebers table In that table is a field for members location... When a member logs in I want it to display 50 people who are from the same location from them However, a few locations only have 20 members or so from them and I must generate 50 profiles It would be ok to have a list of 20 then 30 random ones.. How could I perform this search in 1 query? Basically find the first 50 matches for the location and if cant find 50 match just display any location for the next 30.. Quote Link to comment https://forums.phpfreaks.com/topic/54199-select/ Share on other sites More sharing options...
dbillings Posted June 5, 2007 Share Posted June 5, 2007 I query right. Quote Link to comment https://forums.phpfreaks.com/topic/54199-select/#findComment-268003 Share on other sites More sharing options...
dough boy Posted June 5, 2007 Share Posted June 5, 2007 What determines the location? Is it the zipcode? If it is the zipcode you could easily get the 50 closest members to them. Quote Link to comment https://forums.phpfreaks.com/topic/54199-select/#findComment-268017 Share on other sites More sharing options...
dbillings Posted June 5, 2007 Share Posted June 5, 2007 Good idea dough boy. Quote Link to comment https://forums.phpfreaks.com/topic/54199-select/#findComment-268037 Share on other sites More sharing options...
chigley Posted June 5, 2007 Share Posted June 5, 2007 mysql_query("SELECT * FROM members WHERE location = '{$userlocation}' LIMIT 50") or die(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/54199-select/#findComment-268319 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.