>It looks like I should be using is_null(), but I'm not sure how to use it,
>especially since all of this is embedded in a print statement.

is_null() is new-fangled, and while I assume it matches up with SQL NULL,
it's *POSSIBLE* that PHP's NULL is for something entirely different than SQL
NULL.  Read the docs.

>Instead of just printing Email: $row[1], I'd like to test whether it's null
>first--maybe something like this?
>if (is_null($row[1])) print " " else print ("Email: $row[0]")
>but can I put that line inside of another print statement?  if so, do I have
>to escape the quotation marks?  Please forgive my confusion--I'm new to
>programming in general and PHP in particular.

Several options are available.

In all cases, I've replaced the if/else with the trinary ? : operator.  Less

$email = is_null($row[0]) ? 'NULL' : $email;
# Didja know you could just hit TAB instead of that funky \t stuff?  Way
prettier, IMNSHO.
print("    <tr><td>$email</td>...");

print("    <TR><TD>" . is_null($row[0]) ? 'NULL' : $email . "</TD>";

#echo will take as many arguments as you like.
echo "<TR><TD>", is_null($row[0]) ? 'NULL' : $email, "</TD>...";

Like Music?  http://l-i-e.com/artists.htm

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

Reply via email to