Where, oh where, are the wheres?
Where, oh where, are the wheres?
Say I'm designing a table that lists occupations of rooms in a hotel. The client has asked to filter the table by a specific date, so that she can get a "snapshot" of the occupied rooms in days past. Rooms that are occupied have a null value in the checkout field.
So, I'm trying to do something like:
[code]
$editor->where('checkin',$_GET["atdate"],"<=")
->where('checkout',$_GET["atdate"],">=");
[/code]
This works, but it doesn't capture where rooms are still currently occupied during that time period. I've tried the following, but it doesn't work, as or_where isn't exposed at this level, apparently:
[code]
$editor->where('checkin',$_GET["atdate"],"<=")
->where('checkout',$_GET["atdate"],">=")
->or_where('checkout',null,'is');
[/code]
Does anyone have any suggestions for how I can achieve this?
So, I'm trying to do something like:
[code]
$editor->where('checkin',$_GET["atdate"],"<=")
->where('checkout',$_GET["atdate"],">=");
[/code]
This works, but it doesn't capture where rooms are still currently occupied during that time period. I've tried the following, but it doesn't work, as or_where isn't exposed at this level, apparently:
[code]
$editor->where('checkin',$_GET["atdate"],"<=")
->where('checkout',$_GET["atdate"],">=")
->or_where('checkout',null,'is');
[/code]
Does anyone have any suggestions for how I can achieve this?
This discussion has been closed.
Replies
[code]
if ( !isset($_POST['action']) ) {
// Get data
$data = $db->sql( 'SELECT .... FROM ... WHERE ... ' )->fetchAll();
echo json_encode( array( 'aaData' => $data ) );
}
else {
Editor::inst( $db, 'users' )
->...
->process( $_POST )
->json();
}
[/code]
Regards,
Allan