1

I have some php pulling some data from my database, and after I added another query, I get this error:

Fatal error: Uncaught exception 'Exception' with message 'Database Error [2014] Commands out of sync; you can't run this command now' in C:\wamp64\www\CubePicker\cube.php on line 21

What does this exception mean? This is my php:

<?php

require("./core.php"); 

$id = $_GET["id"];

$query = ($db->query("SELECT * FROM Cube WHERE CubeId='$id'"));

$row = $query->fetch_assoc();
$title = $row["Name"] . " - CubePicker";

$query = ($db->query("CALL GetLatestCubePrice(1, $id)"));
$row = $query->fetch_assoc();
$latestPrice = $row["Price"];


//$CubeInstQuery = ($db->query("call GetCubeInst(1);"));
$CubeInstQuery = ($db->query("SELECT * FROM cubeprice.cubeinst WHERE CubeID = $id;"));
if (!$result) {
    throw new Exception("Database Error [{$db->errno}] {$db->error}");
}
$Inst = $CubeInstQuery->fetch_assoc();
echo $Inst["URL"];

The exception has something to do with the previous database calls. Am I somehow not finishing off the previous query? How can I fix this?

Thanks!

EDIT: I have been through every answer in the duplicate, and nothing works for me.

MattyAB
  • 365
  • 2
  • 9
  • 19

0 Answers0