In my codeigniter PHP model I have
if ($this->input->post('questions') != "")
{
if($this->input->post('questions') == "Yes")
{
$this->db->where('webinar_event.questions !=',"");
$this->db->where('webinar_event.questions IS NOT ', null, false);
}
else
{
$this->db->where('webinar_event.questions',"");
$this->db->where('webinar_event.questions IS', null, true);
}
Yet when I run a
echo $this->db->last_query();
I get this error
'Error Number: 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 5
SELECT * FROM (`health_professional`) JOIN `webinar_event` ON `webinar_event`.`hpid` = `health_professional`.`hpid` WHERE `webinar_event`.`questions` = '' AND `webinar_event`.`questions` IS
Filename: D:\Development\PfizerWebinar\web\system\database\DB_driver.php
Line Number: 330'
Basically what I am trying to do is make it a if I search for "did ask question" I get anything that isnt null and if I want to search for if they did ask a question show me all the ones that are not null.