|
Posted by linda on 11/01/06 15:41
"Martin Mouritzen" <martin@siteloom.dk> wrote in message
news:nn8hk2h3l5up0u7o8ctg6hropu3et5b8du@4ax.com...
> On Wed, 1 Nov 2006 09:40:02 -0000, "linda" <n0spamF0rme@tiscali.co.uk>
> wrote:
>
>>$n = ($row['price']) ;
>>number_format ($n, 2);
>
> As Peter stated, try this:
>
> $n = ($row['price']);
> if ($n) {
> print number_format($n, 2);
> }
>
> --
> Med venlig hilsen,
> Martin Mouritzen.
> http://www.siteloom.dk
Hi Martin,
I did actually an if along those lines:
[php]
// Fetch and print all the records.
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$n = ($row['price']);
if ($n) {
number_format($n,2);
?>
</TR>
<TD ALIGN="center" VALIGN="middle"><a href="image_window.php?id=<? echo
$row['id'] ; ?>" onclick="window.open(this.href, 'child',
'height=300,width=431'); return false"><img src="img/<? echo $row['sm_pic']
; ?>" class="imageborder"/></a></TD><TD><b><? echo $row['name'] ;
?></b><br><br><? echo stripslashes ($row['info']) ; ?><br><br><div
class="<?php echo $row['name']; ?>">£<? echo number_format ($n, 2) ;
?></div><br><br><hr></TD>
</TR>
<?php
}
}
mysql_free_result ($result); // Free up the resources.
mysql_close(); // Close the database connection.
?>
[/php]
It does remove the null value, but it also removes every thing associated
with this entry. The name, info, id etc..
What I'm trying to achieve, but going no where fast ;-( is to just remove
the null price. I haven't been doing php for that long, so I'm finding it a
real battle. I'm now five days into this problem, and haven't come close to
solving it.
Many thanks in advance, I really appreciate it!
Best wishes,
Linda
[Back to original message]
|