npsari Posted April 23, 2007 Share Posted April 23, 2007 I have a retreive code $q = "SELECT DISTINCT Town FROM ads ORDER BY Town ASC LIMIT 12;"; $res = @mysql_query($q); while($r = @mysql_fetch_array($res)) { echo "$r['Town']}"; } It echos Town names But I dont want the Town London to show How can i do that Link to comment https://forums.phpfreaks.com/topic/48371-how-can-i-exclude-a-town-from-the-list-of-towns/ Share on other sites More sharing options...
trq Posted April 23, 2007 Share Posted April 23, 2007 while($r = @mysql_fetch_array($res)) { if ($r['town'] != 'London'; echo $r['Town']; } } Better still... $q = "SELECT DISTINCT Town FROM ads WHERE Town <> 'London' ORDER BY Town ASC LIMIT 12;"; Link to comment https://forums.phpfreaks.com/topic/48371-how-can-i-exclude-a-town-from-the-list-of-towns/#findComment-236477 Share on other sites More sharing options...
npsari Posted April 23, 2007 Author Share Posted April 23, 2007 Hey, thanks Dont u think php should create something better like the exclude function Select distinct Town from ads exclude 'London' AND 'etc..' Link to comment https://forums.phpfreaks.com/topic/48371-how-can-i-exclude-a-town-from-the-list-of-towns/#findComment-236482 Share on other sites More sharing options...
trq Posted April 23, 2007 Share Posted April 23, 2007 Thats SQL, nothing to do with PHP. Link to comment https://forums.phpfreaks.com/topic/48371-how-can-i-exclude-a-town-from-the-list-of-towns/#findComment-236485 Share on other sites More sharing options...
npsari Posted April 23, 2007 Author Share Posted April 23, 2007 ohh, really, well, didnt know that, sorryz Link to comment https://forums.phpfreaks.com/topic/48371-how-can-i-exclude-a-town-from-the-list-of-towns/#findComment-236488 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.