UPDATE: The query is working perfectly as follows; the error solely appears when I select from the view.
$query = "
SELECT ModuleID, ModuleName, Credits, Lecturer, Room, EmployeeID, Forename, Surname, RoomID, RoomCode
FROM ((Module
INNER JOIN Employee ON Module.Lecturer = Employee.EmployeeID)
INNER JOIN Room ON Module.Room = Room.RoomID)
";
$result = $DBH->prepare($query);
$result->execute();
$data = $result->fetchAll();
I'm receiving the following error when trying to SELECT * FROM
a view I created. (Selecting from a table works perfectly).
Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 1615 Prepared statement needs to be re-prepared'
I have no issues when using
SELECT * FROM Module
Here is my query:
$query = "
SELECT * FROM module_info
";
$result = $DBH->prepare($query);
$result->execute();
$data = $result->fetchAll();
The view I created:
CREATE VIEW module_info
AS
SELECT ModuleID, ModuleName, Credits, Lecturer, Room, EmployeeID, Forename, Surname, RoomID, RoomCode
FROM ((Module
INNER JOIN Employee ON Module.Lecturer = Employee.EmployeeID)
INNER JOIN Room ON Module.Room = Room.RoomID);