Detecting if SQL string is empty

I am quite new so please take it easy on me :slight_smile:
And yes, I tried Googling but I couldn’t figure out the keywords or there wasn’t any topics about this anywhere.

So I am writing an easy page for studing SQL and PHP together. In SQL I have a small database, with user id, name, twitter and facebook addreses. My question is, how to detect if an field is empty and not display the hyperlink if its empty?
[php]<img src"twitter.png">[/php]

So basically it would just not show the twitter picture

Thanks!

If it is a string you can test its str length with strlen()

so
[php]if(strlen($twitter) > 0){
echo ‘’;
}[/php]

To see if true or false (1 or 0) value you can do this
[php]if($twitter){
echo ‘’;
}[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service