All pastes #2045147 Raw Edit

Unnamed

public text v1 · immutable
#2045147 ·published 2011-04-11 15:30 UTC
rendered paste body
$sql = 'SELECT id FROM ' . $config['tbl_prefix'] . 'reservations WHERE  car_id = ' . $car_id . ' AND \'' . $start_date . ' ' . $start_time . '\' BETWEEN start_datetime AND end_datetime AND \'' . $end_date . ' ' . $end_time . '\' BETWEEN start_datetime AND end_datetime';
	
	/* print $sql;
	exit; */
	
	if ($db->queryUniqueValue($sql)) {
		print 'There is currently another reservation within the date and time range provided';
		exit;
	}
	
	$sql = 'INSERT INTO ' . $config['tbl_prefix'] . 'reservations (car_id, client_id, agent, start_place, end_place, contract, price1, price2, babyseat, boosterseat, remarks, start_datetime, end_datetime) VALUES (\'' . $car_id . '\', \'' . $client_id . '\', \'' . $agent . '\', \'' . $start_place . '\', \'' . $end_place . '\', \'' . $contract . '\', \'' . $price1 . '\', \'' . $price2 . '\', \'' . $babyseat . '\', \'' . $boosterseat . '\', \'' . $remarks . '\', \'' . implode(" ", array($start_date, $start_time)) . '\', \'' . implode(" ", array($end_date, $end_time)) . '\')';
		
	$db->execute($sql);
	
	print $db->lastInsertedId();