I have a table product
that has columns of id, name, price, desc
. But I only need to display price
of a searched product.
For example, when user enters 0001, then the query should execute and return a value to $price
of $5.00.
$sqlprice = $DB->Prepare("SELECT price FROM product WHERE id = '0001'");
$sqlprice -> Execute();
$result = $sqlprice->get_result();
$price = $result->fetch_assoc();
However, the $price
variable does not has any value in it. What I did wrong in my code? I've searched across many threads but it don't seems to have an answer for my problem.