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 Quote Link to comment 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;"; Quote Link to comment Share on other sites More sharing options...
npsari Posted July 16, 2007 Author Share Posted July 16, 2007 thanks thorpe Quote Link to comment 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.