View Full Version : How convert "0" to "n/a"?

08-28-2006, 04:00 AM
I use php to dynamically display numeric data from a mysql database in a table. See it here: http://www.pokerprovince.com/player.php

I would like to make it display "n/a" in place of "0". Essentially I want to convert the number zero to the text n/a.

The code for the table column display is:

<?php echo $row_pokercounts['count_tables']; ?>

Is it possible to add some code to this to do the conversion? Maybe something that says: if count_tables equals 0 then display n/a?

Thanks in advance for any help.

08-28-2006, 04:09 AM
Welcome to CodingForums, clubwager! :D

You just need something like this:


if ($row_pokercounts['count_tables'] == 0) {
echo "n/a";
} else {
echo $row_pokercounts['count_tables'];


08-28-2006, 06:14 AM
That worked perfectly without any changes. Thank you so much!