Check for empty fields in mysql

admin

Administrator
Staff member
Hi I got a slight problem

After fetching a row from a mysql database I want to check one field whether or not it has an entry or not. If the field is blank then I want to give it a certain value (pic.gif) if it is not empty the vlaue shall remain as it is in the database.
$link is the variable for the field.
$link = $sql->data[4];

How do i check whether the field is empty or not, I tried following:

if (empty($link)):
and
if ($link == "0"):

and other but nothing worked.
You have some ideas.
Probably very easy but I'm still new to PHP.

Thanks
Chris
 
Back
Top