Forum Moderators: coopster

Message Too Old, No Replies

PHP/Mysql null result

how to print null to say null

         

rscrsc

5:18 pm on Apr 13, 2006 (gmt 0)

10+ Year Member



I have a PHP page that does a mysql query. The query run fine and I get the correct results. Some of my row have null results. I am printing the results to a html table. How can I make it print "null" instead of having a blank space for a results.

for example.

aa bb cc dd
11 22 44

aa bb cc dd
11 22 null 44

Here is how I am printing the results.
echo '<tr>';
echo $innerrow['rowname'];
echo '<td align="center">',$innerrow['inet_ntoa(ip_src)'],'</td>';
echo '<td align="center">',$innerrow['inet_ntoa(ip_dst)'],'</td>';
echo '<td align="center">',$innerrow['layer4_sport'],'</td>';
echo '<td align="center">',$innerrow['layer4_dport'],'</td>';
echo '<td align="center">',$innerrow['timestamp'],'</td>';

thanks.

Little_G

5:37 pm on Apr 13, 2006 (gmt 0)

10+ Year Member



Hi,

This should work:

echo '<td align="center">',$innerrow['inet_ntoa(ip_src)']?$innerrow['inet_ntoa(ip_src)']:'null','</td>';

Andrew