Having a Problem in fetching the results from db - 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: Having a Problem in fetching the results from db (/showthread.php?tid=633) |
Having a Problem in fetching the results from db - Chandini - 12-29-2014 Hai , Friends ... I am facing the problem in fetching the results from database ... ... the below code is working perfectly but i am not understand the code plz give clarify .. when its where condition is depends .. if i change the page field then also working perfectly .. what's going on i not understood help me .. Thanks .....! [attachment=55][attachment=57][attachment=58][attachment=56] RE: Having a Problem in fetching the results from db - Avenirer - 12-29-2014 So many "...", so not a question... RE: Having a Problem in fetching the results from db - wolfgang1983 - 12-29-2014 (12-29-2014, 05:31 AM)Chandini Wrote: Hai , Friends ... Try some thing like this in model to get data PHP Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); RE: Having a Problem in fetching the results from db - RobertSF - 12-30-2014 (12-29-2014, 05:31 AM)Chandini Wrote: Hai , Friends ... Hi, Chandini. The code works perfectly? Because your getData function seems to have a problem in the line: PHP Code: $query=$this->db->get_where("pagedata"); According to the manual, the get_where function is used like this: PHP Code: $query = $this->db->get_where('mytable', array('id' => $id)); You have to tell get_where the name of your table, and you have to give it an array to construct the where clause. I don't know the name of your table in the last attached screenshot, but suppose your table is called 'pages', so then your getData should be like this: PHP Code: function getData($what_page) And you would call getData like this: PHP Code: $data['results'] = $this->model_get->getData(array('page' => 'home')); If you know SQL, I think it's easier to just use the query function like this: PHP Code: function getData($what_page) Ok, good luck. I hope the above helps. RE: Having a Problem in fetching the results from db - SomeGuy - 01-03-2015 (12-30-2014, 08:25 AM)RobertSF Wrote:(12-29-2014, 05:31 AM)Chandini Wrote: Hai , Friends ... https://ellislab.com/codeIgniter/user-guide/database/queries.html Specifically the part about "Escaping Queries" |