Booking with Date/Time in mySQL : My Code!!

From: Date: Wed, 21 Mar 2001 05:49:11 +0000
Subject: Booking with Date/Time in mySQL : My Code!!
Groups: php.general 
Request: Send a blank email to php-general+get-44880@lists.php.net to get a copy of this message
Jeff, following is the code as it comes out in my page...can u tell me what i'm doin wrong, besides the fact that i have to replace that famous "uh ohh i got a row back()" with an actual snippet : <?php $db = mysql_connect("localhost","root"); mysql_select_db("nidc_intranet",$db); $realsdate="$syear"."-"."$smonth"."-"."$stdate"; $realedate="$eyear"."-"."$emonth"."-"."$endate"; $realstime="$shh".":"."$smm"." "."$sttime"; $realetime="$ehh".":"."$emm"." "."$entime"; $result = mysql_query("select * from booking where ('$realsdate'>=sdate and '$realsdate'<=edate) or ('$realedate'>=sdate and '$realedate'<=edate)",$db); if (uh_ohh_I_got_a_row_back()) { echo "Someone else is sleeping in the bed! No can do!"; } else { $sql = "INSERT INTO booking (room,sdate,edate,stime,etime,purpose,reserved) VALUES ('$rooms','$realsdate','$realedate','$realstime','$realetime','$purpose','$res')"; $result = mysql_query($sql) or Die ("An unexpected error occured. Please go back and book again."); echo "<font face=helvetica size=2 color=#140057><b>Thank you! <font color=#ff0000>$rooms</font>, has been booked from <font color=#ff0000>$realsdate</font> to <font color=#ff0000>$realedate</font>. <br><br> ** Entries will be deleted 2 weeks after the End Date. "; } ?> Cheers, T. Edison jr. ===== Rahul S. Johari (Director) ****************************************** Abraxas Technologies Inc. Homepage : http://www.abraxastech.com Email : abraxastech@yahoo.com Tel : 91-4546512/4522124 ******************************************* __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/

« previous php.general (#44880) next »