Sethm Posted January 6, 2010 Share Posted January 6, 2010 I have some code that is using a second database to store the image files for the particular listing in my database. What I am wondering is how to find out how to use an if statement on if there is anything pulled or not when I pull the information from it using the following code: $sql = mysql_query("SELECT * FROM imagedb WHERE listingsid=$id"); I've tried the statement: if ($sql != "") { echo "information"; } It didn't work... Could someone help point me in the right direction? Thanks a lot! Quote Link to comment https://forums.phpfreaks.com/topic/187485-display-based-on-secondary-database-information-being-present-or-not/ Share on other sites More sharing options...
premiso Posted January 6, 2010 Share Posted January 6, 2010 I would suggest using mysql_num_rows if (mysql_num_rows($sql) > 0) { //echo "information returned."; } Should work for you. Quote Link to comment https://forums.phpfreaks.com/topic/187485-display-based-on-secondary-database-information-being-present-or-not/#findComment-989956 Share on other sites More sharing options...
Sethm Posted January 6, 2010 Author Share Posted January 6, 2010 Thank you SOO much for your quick response - saved my hair! Quote Link to comment https://forums.phpfreaks.com/topic/187485-display-based-on-secondary-database-information-being-present-or-not/#findComment-989958 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.