Page 1 of 1

How does one refer to empty cells in mysql?

Posted: Tue May 31, 2011 6:59 am
by drayarms
I have tried the following variations but non works

if($row['relation'] = "" ){

if($row['relation'] = '' ){

if($row['relation'] = NULL ){

if($row['relation'] IS NULL ){

if(strlen($row['relation']) = 0 ){

So how would one refer to a cell that is empty?

Re: How does one refer to empty cells in mysql?

Posted: Tue May 31, 2011 8:17 am
by Celauran
The first mistake that I see is that you are using assignment operators ( = ) instead of comparison operators ( == ). Additionally, if you want to see what a variable contains, why not use var_dump()?

Re: How does one refer to empty cells in mysql?

Posted: Tue May 31, 2011 12:32 pm
by fugix
if($row['relation'] == "" ){

will work

Re: How does one refer to empty cells in mysql?

Posted: Tue May 31, 2011 8:40 pm
by califdon
if(empty($row['relation'])) {