First split up the time and date values and use the [man]strtotime/man [man]date/man function to reformat the date to be the same format as the database
$my_array = array("id" => "2342", "start_date" => "2009-04-29 13:51:00", "end_date" => "2009-04-03 13:59:00");
$startdate = explode(" ", $my_array[start_date]);
$my_array[start_date] = date("n/j/Y", strtotime($startdate[0])) . " 12:00:00 AM";
$my_array[start_time] = $startdate[1];
$enddate = explode(" ", $my_array[end_date]);
$my_array[end_date] = date("n/j/Y", strtotime($enddate[0])) . " 12:00:00 AM";
$my_array[end_time] = $enddate[1];
that will give you an array like
Array (
[id] => 2342
[start_date] => 4/29/2009 12:00:00 AM
[start_time] => 13:51:00
[end_date] => 4/3/2009 12:00:00 AM
[end_time] => 13:59:00
)
and then just make your query compare the array values to the database
$myqry = "SELECT * FROM `mytable` WHERE `id`=".$my_array[id]." AND `date`=".$my_array[start_date]." AND `time_in`=".$my_array[start_time]." AND `time_out`=".$my_array[end_time];
$qryres = mysql_query($myqry);
$numrecs = mysql_num_rows($qryres);
if ($numrecs == 0) {
//insert code here
}
Hope that helps. Do be warned I just hand typed that all so there could be typo's or syntax errors. But it should point you in the right direction