You are here:  » Formating the "Displaying xxx"


Formating the "Displaying xxx"

Submitted by Eddie on Wed, 2006-11-22 08:49 in

David,

I am using

<?php
  require("config.php");
  /*require("includes/database.php");*/
  $sql = "SELECT count(*) as numProducts FROM `".$config_databaseTablePrefix."products`";
  database_querySelect($sql,$rows);
  $numProducts = $rows[0]["numProducts"];
  print "Today ShopSort is comparing ".$numProducts." products";
?>

which gives "Today ShopSort is comparing 63877 products".

What I want is "Today ShopSort is comparing 63,877 products". Is this possible ?

Eddie

Submitted by support on Wed, 2006-11-22 09:12

Hi Eddie,

number_format() will do that for you...

print "Today ShopSort is comparing ".number_format($numProducts)." products";

Cheers,
David.

Submitted by Eddie on Wed, 2006-11-22 10:18

David,

Thanks for that.

Related Question - In the price display:

<?php print $config_currencyHTML.$product["price"]; ?>

is it possible to do the same?

When a price is 899.00 all is fine - but you also get 1599.00 and i would rather 1,599.00

Eddie

Submitted by support on Wed, 2006-11-22 16:32

Hi Eddie,

No problem - just wrap that function around the price...

<?php print $config_currencyHTML.number_format($product["price"]); ?>

Cheers,
David.

Submitted by Eddie on Wed, 2006-11-22 19:30

Thanks David - Works a treat.

Eddie