am attempting to print a dynamically generated web page that shows a product and a price. The web page shows 84.9900 as a price. No $, and 4 places to right of decimal. Please look at the last line of code before the comment.
any help would be greatly appreciated.
any help would be greatly appreciated.
Code:
$query1 = "SELECT ProductName, ProductDescription, UnitsInStock, UnitPrice FROM Products WHERE ProductID = $productID";
$query_handle = $dbh->prepare($query1);
# Executes the SQL statement defined in query1
$query_handle->execute() or die $dbh->errstr;
# Output database results into an array called @product
while ( @product = $query_handle->fetchrow_array() ) {
# @TODO fill in fields below to correspond with SQL statement (anywhere "###" is)
# Added code to pull the corresponding information from the array based upon the indeces
# $price = sprintf ("\$ %.2f", $product[3]);
# format price