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. Link to comment https://forums.phpfreaks.com/topic/181664-solved-check-if-database-is-empty/ 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 } Link to comment https://forums.phpfreaks.com/topic/181664-solved-check-if-database-is-empty/#findComment-958176 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. Link to comment https://forums.phpfreaks.com/topic/181664-solved-check-if-database-is-empty/#findComment-958178 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.