I have 4 dropdown menus that on submit may or may not contain values that would be a where statement in a mysql query. Basically with out writing and if statement for every possible combination of dropdown I'd like to figure out a way to insert the where statement if $_POST['dropdownitem'] isn't empty. In the below block essentially anything with $_POST may or may not be there.
$select = dbz( )
->select( )
->from( array( 'l' => 'logs' ) )
->joinLeft( array( 'd' => 'dealers' ), 'l.dealerID = d.id' )
->joinLeft( array( 'p' => 'prospects' ), 'l.dealerID = p.id', array( 'id', 'name AS pname' ) )
->where( 'l.id = ?', $currentUser[ 'id' ] )
->where( 'l.dealerId = ?', $_POST[ 'dealerid' ] )
->where( 'logData LIKE ?', '%' . $_POST[ 'activitytype' ] . '%' );
->where( 'logTime >= ?', $today )
->where( 'logTime < ?', strtotime( $tomorrow ) );
$userLogs = dbz( )->fetchAll( $select );