zepernick/Codeigniter-DataTables

Having problem regarding whereClauseArray()

takerukimura opened this issue · 1 comments

Hi Zepernick,

Im having problem regarding whereClauseArray() function. What I want to do is using where clause to find event_id = $_GET['id]. So I wrote like this :
public function whereClauseArray(){ $conditions = array(); $conditions['event_id ='] = $this->input->get('id'); return $conditions; }
But it can't find any data. If I do like this :
public function whereClauseArray(){ $conditions = array(); $conditions['event_id ='] = 5; return $conditions; }
The data will come out. Is there any specific method to using value from $_GET ?

Hi,
As we call that class via ajax so you have to pass url query args with the URL you are calling AJAx

let say posts is your controller and there is a method doajax where your DataTable logic is
so you are calling
http://someone.com/posts/doajax

in the jquery of your DataTable.

Now the magic is here. you have to pass the $_GET args here like
http://someone.com/posts/doajax?id=1

Hope it will help