Here's my problem: I'd like to make the printing of some text dependent on
whether or not a variable is null. In the following example, when $row
is null, what gets printed on the page is "Email: ". I'd like the
script to not print "Email:" if row is null.
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.
while ($row = mysql_fetch_row ($result))
print ("\t<tr bgcolor=\"#ff9900\">\n\t\t<th>$row</th>\n</tr>\n\t<tr
class=\"default\" bgcolor=\"#ffffff\">\n\t\t<td><p>$row</p><p>Email: <a
href=\"mailto:$row\">$row</a><br />Phone: $row</p>\n\n<p>Address:
$row<br />$row<br />$row $row $row</p> <p>URL: <a
Instead of just printing Email: $row, I'd like to test whether it's null
first--maybe something like this?
if (is_null($row)) print " " else print ("Email: $row")
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.
Thanks in advance for your help.
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php