tecmeister Posted November 16, 2009 Share Posted November 16, 2009 Hi Guys, I'm trying to check the database to see if the user has inserted any images. I've tried: if(empty()) SELECT COUNT(userid) FROM personalImage WHERE userid='$id'. Please will you be able to help me and tell me what I need to do. Thanks, tecmeister. Quote Link to comment Share on other sites More sharing options...
trq Posted November 16, 2009 Share Posted November 16, 2009 $sql = "SELECT userid FROM personalImage WHERE userid='$id'"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { // The user has images } else { // The user has no images } } else { // Query failed } Quote Link to comment Share on other sites More sharing options...
tecmeister Posted November 16, 2009 Author Share Posted November 16, 2009 Thank you so much for your help. 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.