Jump to content


where and filter options does not works using flexigrid

where filter

  • Please log in to reply
No replies to this topic

#1 Wilder Batista González

Wilder Batista González

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 23 April 2014 - 05:04 PM

Hello to everybody:

I have used Grocery CRUD in my Apps and have noted that when I use where option in my functions the filter options doesn't works, using flexigrid theme too. The following example is a simple modification in your example.php controller in the customers_management funtion, note that I add the line $crud->where("country", "USA"); to ilustrate the bug:

 

public function customers_management()
    {
            $crud = new grocery_CRUD();

            $crud->set_table('customers');
            $crud->where("country", "USA");
            $crud->columns('customerName','contactLastName','phone','city','country','salesRepEmployeeNumber','creditLimit');
            $crud->display_as('salesRepEmployeeNumber','from Employeer')
                 ->display_as('customerName','Name')
                 ->display_as('contactLastName','Last Name');
            $crud->set_subject('Customer');
            $crud->set_relation('salesRepEmployeeNumber','employees','lastName');

            $output = $crud->render();

            $this->_example_output($output);
    }

 

Everything works except when I want to filter for any column a database error is triggered:

 

A Database Error Occurred
Error Number: 1054 Unknown column 'country' in 'having clause

 

'SELECT COUNT(*) AS `numrows`
FROM (`customers`)
WHERE `country` =  'USA'
AND  `customerName`  LIKE '%muscle%'
OR  `contactLastName`  LIKE '%muscle%'
OR  `phone`  LIKE '%muscle%'
OR  `city`  LIKE '%muscle%'
OR  `country`  LIKE '%muscle%'
OR  `salesRepEmployeeNumber`  LIKE '%muscle%'
OR  `creditLimit`  LIKE '%muscle%'
HAVING `country` =  'USA'

 

Filename: D:\USBWebserver v8.5\root\Grocery_CRUD\system\database\DB_driver.php

Line Number: 330

 

Advanced thanks for your help

 

 

 







Also tagged with one or more of these keywords: where, filter

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users