Forum Moderators: coopster
I am very new to PHP and have set up a table in a MySQL database. The database is called 'newstar' and the table is called 'products' this has a column called
Price_Prod. The column type is Decimal(9,2). 3.49
3.99
3.99
3.49
I have tried to take these values out of the database with the following script:
<?php $cntx=mysqli_connect("localhost","root","password","newstar")
or die ("New star Access denied");
$query="SELECT * FROM PRODUCTS WHERE Prod_Price = 3.49";
$result = mysqli_query($cntx,$query)
or die ("Query Not Executed!");
while($length = mysqli_fetch_assoc($result))
{
extract ($length);
$f_price = number_format($Prod_Price,2);
echo $Prod_Name, " ";
echo $f_price, "<br/>";
}
?>
The result I get for this is:
Chicken Curry 0.00
Chicken Fu Yung 0.00
Chicken Chop Suey 0.00
Chicken Chow Main 0.00
Chicken Pineapple 0.00
Chicken Satay 0.00 Its like theirs no value in the $f_price.
Please help if you can.
Regards
erdy.
thanks for the reply. Sorry the mistake was only in the post I sent to the forum not in the actual Database.
I do have the values in the database column as 3.49 etc.
Should I have them as 349 instead?
Bearing in mind that the column type is decimal(9,2).
What would you use as a column type for a list of product prices?
Thanks
Erdy