hi
thanks for your reply
in the code given below time inserted in the database field is integer and it compares new inserting value as integer. but what i want to do is insert time in database in the format 2:30 and date as 08-09-2007.But at my present code the time is inserted as 230 not 2:30 n the same thing i want to do with date. i want to compare newly inserting date and time with the existing values in the database n insert if they are not present in the database. so pls give me the idea how can i do this .
the code goes like this
if(isset($_REQUEST['timesubmit']))
{
$fromhr=$_REQUEST['from'];
$tohr=$_REQUEST['to'];
$frommin=$_REQUEST['fromtime'];
$tomin=$_REQUEST['totime'];
$from=$fromhr.$frommin;
$to=$tohr.$tomin;
//echo $from;
$day=date("d");
$month=date("m");
$year=date("Y");
$array = array($day,$month,$year);
$date = implode("-", $array);
if(($from <$to))
{
$que1= "SELECT * FROM voyance_user_reservation WHERE (user_reserve_time_end > $from AND user_reserve_time_start < $to)";
//echo $que1;
$result1 = mysql_query($que1);
if (mysql_num_rows($result1)!=0)
{
$var1=true;
$app->error_display_type=2;
$app->error("This record overlaps existing time slots");
}
else
{
$var2=true;
$que2="insert into voyance_user_reservation values('','".$from."','".$to."','".$date."','','')";
$result2=mysql_query($que2);
$app->error_display_type=2;
$app->error("Time Reserved Successfuly");
}
}
else
{
$var3=true;
$app->error_display_type=2;
$app->error("Start Time Cannot Be Greater Than Or Equal To The End Time");
}
}
code in html goes like this
<select name="from">
<? for($i=1;$i<=24;$i++){?>
<option value="<?=$i;?>"><? echo $i;?></option>
<? }?>
</select>
</td>
<td><select name="fromtime">
<option value="10">10</option>
<option value="20">20</option>
<option value="30">30</option>
<option value="40">40</option>
<option value="50">50</option>
</select>
thank u very much