Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Orm
Search records with empty value with ORM
oldy
March 2015
How can I do a search like this with ORM
SELECT * FROM table_name WHERE field_name != '';
I want to find records which one field does not have any value.
I tried the following with no success and I know why.
Model_Table::query()->where('field_name', '!=', '')->get();
Those two single quotes are enclosed by another quotes?
How do I bypass this and execute a correct search?
Thanks.
Harro
March 2015
Accepted Answer
That ORM statement generates exactly that query. Single or double quotes are irrelevant. You can check that by dumping the last_query(), or by using the profiler (with DB profiling enabled).
Add a Comment
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
5,089
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
261
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
Harro
March 2015