Hi,
If I enter the following SELECT statement in phpMyAdmin it works ok
but if I try the following in PHP it returns the following error: Fatal error: Call to a member function fetch_array() on boolean in C:\wamp64\ on line 37 (the line beginning $a_fetch)
$conn is returned from an initial call to a mysqli connect string, and works fine in other db calls throughout the program.
I have tried enclosing column/table names in backticks, but makes no difference.
Can anyone tell me where I am going wrong?
Thanks
If I enter the following SELECT statement in phpMyAdmin it works ok
Code:
SELECT A.class_id, A.attend, A.mem_id, B.firstname, B.lastname FROM attendance AS A INNER JOIN memberdetails AS B ON B.mem_id = A.mem_id WHERE A.class_id=5 ORDER BY B.lastname, B.firstname ASC
but if I try the following in PHP it returns the following error: Fatal error: Call to a member function fetch_array() on boolean in C:\wamp64\ on line 37 (the line beginning $a_fetch)
PHP:
$a_query = $conn->query('SELECT A.class_id, A.attend, A.mem_id, B.firstname, B.lastname FROM attendance AS A INNER JOIN memberdetails AS B ON B.mem_id = A.mem_id WHERE A.class_id=5 ORDER BY B.lastname. B.firstname ASC') or die(mysqli_error($conn));
$a_fetch = $a_query->fetch_array();
$conn is returned from an initial call to a mysqli connect string, and works fine in other db calls throughout the program.
I have tried enclosing column/table names in backticks, but makes no difference.
Can anyone tell me where I am going wrong?
Thanks