Jump to content

Checking to see if a value returned from the database is blank or not?


galvin

Recommended Posts

Probably a silly question, but say you have a value in a mysql database that (naturally) can be either be blank or have characters in it.

 

If in my PHP I am doing a check to see if that returned field from the database HAS or DOES NOT HAVE a value entered in it, what is the proper way to do it?

 

For example, you could do either of the following below (and I'm sure there are probably 10 other ways to do it as well).  Is one of these quicker/more efficient than the other? 

 

I  know it probably does not matter in the grand scheme of things because it's such a quick check either way, but if one way is more "proper" than the other, please let me know...

if ($mysqlvalue!=="") 
OR
if (strlen($mysqlvalue>0))
OR 

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.