<?php
namespace Hera;
require_once ("dbcontroller.php");
$db_handle = new DBController();
$productByCode = $db_handle->runQuery("SELECT * FROM tblproduct WHERE code='LPN45'");
$itemArray = array(
$productByCode[0]["code"] => array(
'id' => $productByCode[0]["id"],
'name' => $productByCode[0]["name"],
'code' => $productByCode[0]["code"],
'quantity' =>2,
'price' => "999",
'image' => $productByCode[0]["image"]
)
);
echo print_r($productByCode[0]["price"]);
echo "<br>";
echo $productByCode[0]["price"];
echo "<br>";
print_r($productByCode[0]["price"]);
echo "<br>";
echo round($productByCode[0]["price"], 2);
echo "<br>";
?>
It, doesn't pull the 999, it results in:800.001
800.00
800.00
800
Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>
Our community of experts have been thoroughly vetted for their expertise and industry experience.