Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Bug if use where clause #211
Hi all! I have little question. When in method's used where clause (for example):
Search don't work. Ajax request return 500 Internal Server Error and information that this column don't exist.
Error Number: 1054 Unknown column 'manager' in 'having clause' SELECT COUNT(*) AS `numrows` FROM (`users`) WHERE `manager` = 1 AND `first_name` LIKE '%query%' OR `last_name` LIKE '%query%' HAVING `manager` = 1 #Filename: /var/www/grocery_crud_model.php Line Number: 191
How to solve this bug? If remove where clause - search work fine. I hope you help me. And sorry for my bad english.
referenced this issue
Jul 10, 2013
referenced this issue
Jul 13, 2013
added a commit
Oct 6, 2013
Hi @diwms. I am using CI 3.0 and GC 1.5.0 and this is the controller code from the accompanying GC sample. I just added a field called
I hope you can help me out.
i add to employees_management() function in Examples.php:
If i search "Patter" string with "Search all" option, then i get all the rows with officeCode=1. If i seach with "LastName", i just get a row.
It uses "or" instead of "and" here:
I have been struggling with a similar problem. First I had a 500 error with Flexigrid with the AJAX_LIST call whenever I had a WHERE clause in my controller. The where clause was always related to a foreign key. I fixed this issue by replacing having with where on line 635.
Next I wanted to resolve the issue that it searches for your search string OR your where clause. I wanted it to be AND. So I also changed the rest of the function after line 635 into this:
I can't reproduce this error. This is probably solved at the latest version. Can you please check the latest master version (https://github.com/scoumbourdis/grocery-crud/archive/master.zip)
If the bug still occurs, please add as comments:
if i use WHERE construction in Controller search dont work
If I comment the line
Before that I completely updated on your link
Hi - i can reproduce this issue with the latest master:
If i use "search all" in this case for "hausr" there is a 500er error coming up:
A Database Error Occurred
Unknown column 'deleted' in 'having clause'
Line Number: 691
As you can see the
So there is an issue with "search all" in case you use a "$crud->where"
I am glad to inform you that this bug is (finally) reproduced and also fixed. You can now have this functionality from the latest master version. I am doing some more testing in order to have a very cool release for version 1.6.0 just before Christmas.
Let me know if you have any issues with the fix.
This bug still happen. I used v1.6.1. The newest one.
as you see, i used 'where':
**and when i "search all":
this error causes:**
`A Database Error Occurred
Unknown column 'userName' in 'having clause'
Line Number: 691`