Soldato
- Joined
- 7 Jan 2007
- Posts
- 10,607
- Location
- Sussex, UK
I have a script below where I have ordered the top 3 rows by houseprice.
The trouble is how do I convert the houseprice, which prints as 150000 to 150,000?
I don't need to add the pound sign as I can call that in from a field in the mysql table. I just need to add in the commas automatically.
Any ideas?
The trouble is how do I convert the houseprice, which prints as 150000 to 150,000?
I don't need to add the pound sign as I can call that in from a field in the mysql table. I just need to add in the commas automatically.
Any ideas?
PHP:
$result = mysql_query("SELECT * FROM table
ORDER by houseprice DESC
LIMIT 3");
while($row = mysql_fetch_array($result)){
echo $row['road']. " - ".($row['houseprice']);
echo "<br />";
}