I am creating a test ecommerce shop but am having problems with two things: 1) My prices have the dollar sign ($) and not the pound sign (£). 2) My prices are rounded up.
This a screenshot
From research on the net I found how to add the pound sign using the following code:
$<?= '£'. number_format($product['list_price'],2); ?>
I had to add £ as the £ caused and black triangle to appear.
This is the result of adding this code:
This is not exactly what I wanted. How do I have the price as £19.99? (or other).
This is the entry in the database:
Both prices (list_price and prices where entered as £24.99 (prices), and £19.99 using the insert option in phomyadim.
This is the php code relating to the products:
<?php require_once 'core/init.php';
$sql = "SELECT * FROM products WHERE featured =1";
$featured = $db->query($sql);
?>
Any help to have my currenct formatted to £, and two decimal places wil lbe appreciated.
Your DB structure is incorrect, 10,0
allows for 0 decimal places. This can be seen here.
http://sqlfiddle.com/#!9/f54cd/1
Change the structure to 10,2
to allow 2 decimal places.
http://sqlfiddle.com/#!9/f1bf0f/1
You can read more about this here,
https://dev.mysql.com/doc/refman/5.7/en/precision-math-decimal-characteristics.html
The black diamond is an encoding issue, use UTF8.