using empty() is ´the right way to check a var for NULL or ""

however, it also depends what MySQL has got as setuo definition for empty
fields. on textfields u can define an epmty string as default.

ralph_def...@yahoo.de

"Dan Shirah" <mrsqua...@gmail.com> wrote in message
news:a16da1ff0909230458o30d66186m75fc4fd0d1972...@mail.gmail.com...
> Morning!
>
> Just a quick question.
>
> Say I have a column in my database that could contain NULLS, empty spaces,
> or an actual value.
>
> If I do:
>
> $my_query = "SELECT my_column FROM my_database WHERE 1 = 1";
> $my_result = ifx_query($my_query, $connect_id);
>
> while($row = ifx_fetch_row($my_result)) {
>   $my_column = trim($row['my_column']);
>
>   if ($my_column != "") {
>    echo "Test";
>   }
> }
>
> The way PHP assigns the query results to the $my_column variable,
wouldn't;
> if ($my_column != "")  not do anything for the rows that contained NULLS
or
> empty spaces?
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to