Comments (3)
Yes I did, sort of,
I do a query, then get results, with the results I do another query, and so on until all are done.
https://gist.github.com/dimitrihilverda/dde5fa04b05bdb1a94634dba9b25e64a
from jsonq.
I'm doing and wondering the same thing.
@dimitrihilverda did you ever figure this out?
from jsonq.
I actually found another way to do this using the reset() function. Likeso:
$jsonq = new Jsonq();
$jsonq->json(json_encode($result));
$res = $jsonq
->where('subcategory_website', 'contains', $this->sublevel)
->get();
if( isset($_GET['colour']) ) {
$colour_filters = $_GET['colour'];
$colour_filters = explode(',', $colour_filters);
$jsonq->reset();
foreach ($colour_filters as $key => $value) {
$jsonq->orWhere('colour_website', 'contains', $value);
}
$res = $jsonq->get();
}
if( isset($_GET['material']) ) {
$material_filters = $_GET['material'];
$material_filters = explode(',', $material_filters);
$jsonq->reset();
foreach ($material_filters as $key => $value) {
$jsonq->orWhere('material_website', 'contains', $value);
}
$res = $jsonq->get();
}
if( isset($_GET['age']) ) {
$age_filters = $_GET['age'];
$age_filters = explode(',', $age_filters);
$jsonq->reset();
foreach ($age_filters as $key => $value) {
$jsonq->orWhere('Age (website)', '=', $value);
}
$res = $jsonq->get();
}
Notice that I start off with one required where query, and after that use $jqonq->reset() to function as a sort of AND to then be able to insert as many OR's as needed. And if needed followed again with a reset() AND, and again some OR's.
In the end my $res will hold the result of all queries.
from jsonq.
Related Issues (20)
- foreach() to retrieve records only working once HOT 1
- We can't search the data on LIKE query HOT 4
- how can i get json data from DB ?
- Search with insensitive case ? HOT 2
- array_key_exists() expects parameter 2 to be array, string given HOT 2
- How does the macro condition works? HOT 5
- How to use a previous set as a new set to query over those results? HOT 1
- Getting nth data
- hiding api key from clientside
- Can't get whereIn to work HOT 2
- Getting error on Multidimensional array search HOT 3
- Beerpay link is broken HOT 2
- Contains Condition is Case-Sensitive HOT 2
- installation error HOT 4
- Making nested aggregations to compare student result into materials through multiple months
- #HELP How to Use the "Or from a JSON String" HOT 1
- Beerpay website for sponsoring this repo is not working
- Is this still supported?
- PHP deprecated
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsonq.