Multiple WHERE
Multiple WHERE

Hi guys I have a problem where I am stuck, I have a query to execute the server side code is the following but I don't know how to write it in Editor can you help me?
SELECT * FROM `scrivania`
WHERE
scarico_bo = "2020-10-06" OR delivery = "2020-10-06"
AND
hub = 1
OR
hub = 0 AND start = "HUB"
This is serverside and work.
->where( function ($q) {
if (isset($_POST['startDate'])) {
$q->where('scarico_bo', $_POST['startDate'], '=');
->or_where( function ( $r ) {
$r->where('delivery', $_POST['startDate'], '=');
});
$q->where( 'hub',1)
->or_where( function ( $r ) {
$r->where( 'hub', 0 );
$r->where( 'start', 'HUB' );
});
}
})
this is clientside by Editor and not work..
This discussion has been closed.
Answers
Try this - it looks like you have a few PHP syntax errors in the above code:
Allan
Hello @allan thanks for the hint but it doesn't work I'll explain the criterion with which the server-side query works based on the date it also loads the other conditions, instead here it loads all the conditions that I give it in the sense, it loads me the line where hub = 1 however does not correspond with the date that was sent with "startDate", I need that based on "startDate" it finds all the data, the server-side query is right but I don't know how to write it on the client side with Editor ..
it does if you provide the start date
there are no client side queries, SQL is server side only
Add
->debug(true)
just before the->process(...)
call. Then check the response from the server in your browser's network inspector. It will include the SQL that was generated. Perhaps you can copy and paste that here if it doesn't make sense.Allan