Having a Problem in fetching the results from db |
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]
Manikanta
(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');
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
(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. (12-30-2014, 08:25 AM)RobertSF Wrote:(12-29-2014, 05:31 AM)Chandini Wrote: Hai , Friends ... https://ellislab.com/codeIgniter/user-gu...eries.html Specifically the part about "Escaping Queries" |
Welcome Guest, Not a member yet? Register Sign In |