npsari Posted July 16, 2007 Share Posted July 16, 2007 Hello there users I have a table called people in which, there is a colomb called Image1 (where users upload their image) I did a little code to show the latest 10 images however, i want the code to show all images, except the ones that are empty (because some users doe not upload image) This is my code: $con=mysql_connect("localhost", "name", "password"); mysql_select_db("database",$con); $q = "SELECT * FROM people ORDER BY Date DESC, Time DESC LIMIT 10;"; $res = @mysql_query($q); What should i add to my code, so that, it ignores empty image1 field Link to comment https://forums.phpfreaks.com/topic/60211-solved-retreiving-data-from-my-database-problem-i-want-to-ignore-empty-images/ Share on other sites More sharing options...
trq Posted July 16, 2007 Share Posted July 16, 2007 $q = "SELECT * FROM people WHERE image1 != '' ORDER BY Date DESC, Time DESC LIMIT 10;"; Link to comment https://forums.phpfreaks.com/topic/60211-solved-retreiving-data-from-my-database-problem-i-want-to-ignore-empty-images/#findComment-299520 Share on other sites More sharing options...
npsari Posted July 16, 2007 Author Share Posted July 16, 2007 thanks thorpe Link to comment https://forums.phpfreaks.com/topic/60211-solved-retreiving-data-from-my-database-problem-i-want-to-ignore-empty-images/#findComment-299521 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.