如何在视图中记录是否为空?

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.

    Try this 


      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', null, false);
        }
        else
        {
            $this->db->where('webinar_event.questions',"");
            $this->db->where('webinar_event.questions IS NULL', null, true);
        }
      }
if(!empty($var)){
  //do stuff
}

here we check if the variable is not empty hence the ! or you can use:

if(isset($var)){
 //do stuff
}

this checks if the variable is set. or:

if(is_null($var)){

}else{
  //do stuff
}

whichever you preffer, or a combination of isset and !empty is usually what I go for.