remybink Posted July 30, 2011 Share Posted July 30, 2011 $width = ($row['width']); if ($width == NULL){ $width = "Call"; }else { $width = $width .' '.'in.'; } What would be a simpler way to write this? Or should I say better? I am not ready for the "switch" method, would prefer the longer form. This script works. However, i want to get no output if the result is empty or NULL. The reason I chose a string was that I had issues and placing a string seemed to fix it. Quote Link to comment https://forums.phpfreaks.com/topic/243237-simplify-query-for-null/ Share on other sites More sharing options...
trq Posted July 30, 2011 Share Posted July 30, 2011 $width = $row['width']; if ($width) { $width .= 'in.'; } Quote Link to comment https://forums.phpfreaks.com/topic/243237-simplify-query-for-null/#findComment-1249256 Share on other sites More sharing options...
remybink Posted July 30, 2011 Author Share Posted July 30, 2011 oh. wow. I feel stupid. Quote Link to comment https://forums.phpfreaks.com/topic/243237-simplify-query-for-null/#findComment-1249260 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.