I have written code so that when something from a MySQL field equals 0, then PHP will take no action, and if the field equals anything else, then 'echo "foo"'.
The problem I am having is that when PHP echo's nothing, its still creating the effect of a HTML <BR>.
Screen shots:
1. When the MySQL table contains something else than 0 (echo "foo").
2. When the table contains 0 (echo "").
3. What it should look like if the table were to contain 0 (echo ""). Note that their is no <BR> effect.
Code:
Is it possible to make it so if a MySQL field result equals 0, then PHP will not produce the HTML <BR> effect when it echo's nothing (echo "")?
The problem I am having is that when PHP echo's nothing, its still creating the effect of a HTML <BR>.
Screen shots:
1. When the MySQL table contains something else than 0 (echo "foo").
2. When the table contains 0 (echo "").
3. What it should look like if the table were to contain 0 (echo ""). Note that their is no <BR> effect.
Code:
PHP Code:
$query = "select sizes from products where id='$id'";
$result = mysql_query($query);
$data = mysql_fetch_array($result);
if ($data['sizes'] == 0) {echo "";} else {echo "Small - ".$data['sizes'];}
Is it possible to make it so if a MySQL field result equals 0, then PHP will not produce the HTML <BR> effect when it echo's nothing (echo "")?
Comment