Bar2aYunie
06-23-2010, 09:37 PM
Hello,
I have some numbers in two of my columns of my database. Sometimes, this number is set, sometimes, this number is 0. When it's 0, I'd like to hide it, make sure that it's not displayed.
Here's my current code: (part of it)
<?php
while($item=mysql_fetch_array($finalQuery)){
$base_m=5;
$item['col1'] = round ((($item['col1']+5) *1.85),0); $item['col01'] = $base_m*(ceil(($item['col1'])/$base_m));
$item['col2'] = round ((($item['col2']+5) *1.85),0); $item['col02'] = $base_m*(ceil(($item['col2'])/$base_m));
>?
<td width="50%" align="center"><h4><?php echo "{$item['col01']}?></h4></td>
<td width="50%" align="center"><h4><?php echo "{$item['col02']}?></h4></td>
If both columns are filled with numbers, the math function is added and the numbers are filled perfectly in the table.
However, if one of those numbers is 0, the math function is added and the number turns to 10. I'd like to hide this. Or even all entries that gives a 0, so the math function wouldn't even be calculated at all... In either way, it cannot be shown in the table.
I tried adding it in the select query (where value > 0), but that doesn't work and returns no results at all (nothing, not even other results I'm trying to get after this part of cod). I also tried to use something like "if ($item['col1'] > 0)", but it gives me an error... or executes fine when there's no 0, when there is a 0, I see nothing.....can't get it right.
Does anybody have any idea's?
I have some numbers in two of my columns of my database. Sometimes, this number is set, sometimes, this number is 0. When it's 0, I'd like to hide it, make sure that it's not displayed.
Here's my current code: (part of it)
<?php
while($item=mysql_fetch_array($finalQuery)){
$base_m=5;
$item['col1'] = round ((($item['col1']+5) *1.85),0); $item['col01'] = $base_m*(ceil(($item['col1'])/$base_m));
$item['col2'] = round ((($item['col2']+5) *1.85),0); $item['col02'] = $base_m*(ceil(($item['col2'])/$base_m));
>?
<td width="50%" align="center"><h4><?php echo "{$item['col01']}?></h4></td>
<td width="50%" align="center"><h4><?php echo "{$item['col02']}?></h4></td>
If both columns are filled with numbers, the math function is added and the numbers are filled perfectly in the table.
However, if one of those numbers is 0, the math function is added and the number turns to 10. I'd like to hide this. Or even all entries that gives a 0, so the math function wouldn't even be calculated at all... In either way, it cannot be shown in the table.
I tried adding it in the select query (where value > 0), but that doesn't work and returns no results at all (nothing, not even other results I'm trying to get after this part of cod). I also tried to use something like "if ($item['col1'] > 0)", but it gives me an error... or executes fine when there's no 0, when there is a 0, I see nothing.....can't get it right.
Does anybody have any idea's?