poleposters Posted April 17, 2008 Share Posted April 17, 2008 Hi, I'm grabbing some data out of my database but want to check if its empty before I print it. This is what I'm doing. $phone= 555 5555; print "Ph:$phone"; The problem is if $phone contains an empty string. Ph: will still print. And that looks kinda odd on my page. Can anyone help? Cheers. Link to comment https://forums.phpfreaks.com/topic/101603-how-do-i-test-if-a-record-is-empty-in-my-database/ Share on other sites More sharing options...
Zhadus Posted April 17, 2008 Share Posted April 17, 2008 Read up on empty(). Link to comment https://forums.phpfreaks.com/topic/101603-how-do-i-test-if-a-record-is-empty-in-my-database/#findComment-519809 Share on other sites More sharing options...
craygo Posted April 17, 2008 Share Posted April 17, 2008 $phone = empty($phone) ? "" : "PH:$phone"; Ray Link to comment https://forums.phpfreaks.com/topic/101603-how-do-i-test-if-a-record-is-empty-in-my-database/#findComment-519810 Share on other sites More sharing options...
poleposters Posted April 17, 2008 Author Share Posted April 17, 2008 Thank You! Link to comment https://forums.phpfreaks.com/topic/101603-how-do-i-test-if-a-record-is-empty-in-my-database/#findComment-519861 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.