Error Number: 1054? |
[eluser]SaSa[/eluser]
why this code have error? With respect Code: search_customer = 1;//$this->input->post('search_customer'); Code: A Database Error Occurred
[eluser]JHackamack[/eluser]
Because Active Record is escaping your id=1 resulting in it thinking you have a column name called 'id=1'.
[eluser]JoostV[/eluser]
Code: $result= $this->db->where('id', $search_customer)
[eluser]SaSa[/eluser]
Code: $query = $this->db->where('id', $search_customer)->or_where('name', $search_customer)->get('customer'); i want if input is empty num_row = 0.
[eluser]JoostV[/eluser]
Hi SaSa, if you are wondering what to do with $result you can do var_dump($result); to see what kind of data it is. And write the rest of the code accordingly. I'm guessing it would be something like Code: $result= $this->db->where('id', $search_customer)
[eluser]JoostV[/eluser]
Or shorter Code: echo FALSE == is_array($result) || 0 == count($result) ? 0 : json _encode($result); Hope I didn't leave in any typos. I hate typing code on an iPad ![]()
[eluser]SaSa[/eluser]
Sorry that I misspelled.I do not know much English and it is not my native language. if input($this->input->post('search_customer')) is empty, output is all data in customer database. Indeed if input is empty, must output is 0. now if typed value in input it(where) worked true and output is true. my problem is here that, why input is empty output is all data in table customer in database? see you my output when that input is empty: http://www.freeimagehosting.net/newuploads/3f6bd.gif I am likely the problem is: where But I do not know how to fix? What is your comment? With respect
[eluser]JoostV[/eluser]
I am not quite sure what you mean, but I think it would be something like this: Code: // Set customer from post, XSS filtered |
Welcome Guest, Not a member yet? Register Sign In |