Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

mysqli prepared statement throwing uncaught error

I am attempting to prepare my sql statement however I am getting an error thrown that I cannot discern.

Uncaught Error: Call to a member function fetch_assoc() on bool

I have this error reporting on at the top of my file:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);

Section that fails:

$alreadyHasJob = "SELECT IF( EXISTS(SELECT `id_number` FROM `agent_client_jobs` WHERE `facilitator` = ? and `key` != ? and ? <= `start_TS` AND `start_TS` <= ?), 'YES', 'NO') as 'check'";
$alreadyHasJobPrepared = $MySQL_Read->prepare($alreadyHasJob);
$alreadyHasJobPrepared->bind_param('ssii', $facId, $jobKey, $startOfDate, $endOfDate);
$alreadyHasJobPrepared->execute();
$alreadyHasJobResult = $facilitatorsPrepared->get_result();
$alreadyHasJobData = $alreadyHasJobResult->fetch_assoc();

I have similar statements before and after this one on the same connection and they all pass correctly. I have already checked the types of the binded parameters, substituted my values and run it on phpmyadmin and it runs correctly. It works if I don’t prepare the statement however I want it prepared correctly.

>Solution :

What is your $facilitatorsPrepared and where does it come from?

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading