something causing a server error (500) - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: something causing a server error (500) (/showthread.php?tid=70448) |
something causing a server error (500) - richb201 - 04-10-2018 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(); RE: something causing a server error (500) - jreklund - 04-10-2018 If I'm not mistaken, you can't call num_rows after you have returned a result. PHP Code: $query = $this->db->get_where('employees', array('employee_email'=>$email_key)); RE: something causing a server error (500) - richb201 - 04-10-2018 (04-10-2018, 12:58 PM)jreklund Wrote: If I'm not mistaken, you can't call num_rows after you have returned a result. That was it. thx RE: something causing a server error (500) - richb201 - 04-10-2018 Well that stopped it from crashing. I am trying to return the field $campaign. Here is the code $query=$this->db->get_where('employees', array('employee_email'=>$email_key)); if ($query->result_id->num_rows > 0) { $camp=$query->result()->$campaign; } I thought this would do it but it is returning $camp=null. There are two rows where employee_email=$email_key, so num_rows=2. But how do I reposition the pointer to point at the first row and then get a single value? RE: something causing a server error (500) - richb201 - 04-10-2018 solved. I used: $row=$query->row(); $camp=$row->campaign; row() will return the first row |