How to add to an editor WHERE clause
How to add to an editor WHERE clause
I have the following code and it works fine, however, I need to add something extra to the WHERE clause, specifically, limit the query to include checking a date column only for entries that are "NULL".
Example: "AND kit_inventory_item_history_date_removed IS NULL"
How and/or where could I add this?
Editor::inst( $db, 'kit_inventory_items', 'kit_inventory_items_id' )
->fields(
Field::inst( 'kit_items.kit_items_name' ),
Field::inst( 'kit_inventory_items.kit_inventory_items_serial_number' ),
Field::inst( 'kit_inventory_items.kit_inventory_items_status_id' )
->options( 'kit_inventory_items_status', 'kit_inventory_items_status_id', 'kit_inventory_items_status_status' )
->validator( 'Validate::dbValues' ),
Field::inst( 'kit_inventory_items_status.kit_inventory_items_status_status' ),
Field::inst( 'kit_inventory_items.kit_inventory_items_id' )
)
->leftJoin( 'kit_inventory_items_status', 'kit_inventory_items_status.kit_inventory_items_status_id', '=', 'kit_inventory_items.kit_inventory_items_status_id' )
->leftJoin( 'kit_items', 'kit_items.kit_items_id', '=', 'kit_inventory_items.kit_items_id' )
->leftJoin( 'kit_inventory_item_history', 'kit_inventory_item_history.kit_inventory_items_id', '=', 'kit_inventory_items.kit_inventory_items_id' )
->where( 'kit_inventory_item_history.kit_inventory_id', $_GET["thisinv"] )
->process($_POST)
->json();
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You should be able to add:
on line 18.
Allan
Thanks Allan,
I wasn't sure if i could put multiple where clauses but it works now.