Mutley Posted September 1, 2006 Share Posted September 1, 2006 How do I use an IF statement to do, if there is NOTHING in the database?I tried:if(.....) = 0)...but it looks for a '0' in the database?Thanks. :D Quote Link to comment https://forums.phpfreaks.com/topic/19357-ifrow-nothing/ Share on other sites More sharing options...
wildteen88 Posted September 1, 2006 Share Posted September 1, 2006 Actually you are assing $row['blah'] with zero with the posted code. You use use two equal signs together, or use the empty function to check whether the the variable holds an empty value.[code=php:0]if(empty($row['field_name_here'])){ echo 'field_name_here is empty!';}[/code] Quote Link to comment https://forums.phpfreaks.com/topic/19357-ifrow-nothing/#findComment-83979 Share on other sites More sharing options...
Ifa Posted September 1, 2006 Share Posted September 1, 2006 It's actually empty, not is_empty ;) Quote Link to comment https://forums.phpfreaks.com/topic/19357-ifrow-nothing/#findComment-83980 Share on other sites More sharing options...
wildteen88 Posted September 1, 2006 Share Posted September 1, 2006 Yeah I correct that when I posted. :) Quote Link to comment https://forums.phpfreaks.com/topic/19357-ifrow-nothing/#findComment-83984 Share on other sites More sharing options...
Mutley Posted September 1, 2006 Author Share Posted September 1, 2006 Thanks, worked a treat. :D Quote Link to comment https://forums.phpfreaks.com/topic/19357-ifrow-nothing/#findComment-83985 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.