I am trying to fetch TaxRate data from a table and I'm trying to select the first array only. However, I keep getting this error
"Fatal error: Uncaught Error: Call to a member function fetch_array() on boolean in C:\xampp\htdocs\flowerique\shoppingCart.php:77 Stack trace: #0 {main} thrown in C:\xampp\htdocs\flowerique\shoppingCart.php on line 77"
Does anyone know the cause of this error and how do I fix it? Thanks!
This is my code :
//Retrieve Current GST Pricing
$qry = "SELECT * FROM gst GROUP BY EffectiveDate DESC";
$stmt = $conn->prepare($qry);
$stmt->execute();
//$stmt->close();
$result = $conn->query($qry);
$row = $result->fetch_array(); // This is line 77
while($row["EffectiveDate"] < date("Y-m-d"))
{
$row = $result->fetch_array();
}
$currentTaxRate = $row["TaxRate"];