Welcome Guest, Not a member yet? Register   Sign In
something causing a server error (500)
#1

I have been battling this thing for a few weeks. I kept thinking the problem with the server error was my my js code running in the browser. But it seems that the CI backend is the problem. 
PHP Code:
       $table = array();
 
       if ($this->input->is_ajax_request()) {
 
           $json $this->input->raw_input_stream;
 
           $json json_decode($json);
 
           $email_key $json->email;
 
      //     $sql="Select campaign FROM employees WHERE employee_email=?";
 
       //    $this->db->query($sql,array(1,$email_key));
 
       //    $camp = $this->db->get()->result();
 
           $query=$this->db->get_where('employees', array('employee_email'=>$email_key))->result();
 
           if ($query->num_rows() > 0)   <<<<<This is the line that causes the server error
            
{
 
               $campaign=$query->result();
 
           }
 
           else
            
{
 
               $this->db->close();  //no campaign for this guy
 
               $this->output
                    
->set_content_type('application/json')
 
                   ->set_output(json_encode("user not found"));
 
               return;
 
           
Something is wrong with the num_rows call. The get_where seems to work OK. What am I missing here?
proof that an old dog can learn new tricks
Reply


Messages In This Thread
something causing a server error (500) - by richb201 - 04-10-2018, 12:14 PM



Theme © iAndrew 2016 - Forum software by © MyBB