I’ve been staring at this for hours, it works in mysql.
Any ideas?
Fatal error: Uncaught Exception: Database Error [1064] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘?’ at line 1 in /home2
“`
$Db = new Dbh;
$con = $Db->connect();
$teamList = array();
$SQL = “SELECT t.teamId, t.teamName, t.knownAs, t.teamEmblem, t.teamLogo FROM `teams` t JOIN `competitionteams` c ON t.teamId = c.teamId WHERE c.competitionId = ?”;
$stmt = $con->prepare($SQL);
$stmt->bind_param(‘i’, $competitionId);
$result = $stmt->get_result();
$result = $con->query($SQL);
if (!$result) {
throw new Exception(“Database Error [{$con->errno}] {$con->error}”);
}
while($row = $result->fetch_assoc()){
$Team = new Team(intval($row[‘teamId’]), $row[‘teamName’], $row[‘knownAs’], $row[‘teamEmblem’], $row[‘teamLogo’]);
$teamList[] = $Team;
}
return $teamList;