Re: Inserting DATE in mySQL!!
| From: | (Miles Thompson) | Date: | Mon, 05 Mar 2001 12:10:01 +0000 |
| Subject: | Re: Inserting DATE in mySQL!! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-42605@lists.php.net to get a copy of this message | ||
What field type are you using to store time? Echo your $sql and compare it to MySQL's documentation on the time column and how you have defined the field.
Miles
At 03:51 AM 3/5/01 -0800, Thomas Edison Jr. wrote:
I'm using the following code to insert date into my mySQL table named "Booking". I've created variables that store the date with dashes "-" seperating them. But it's not working. It's giving me an error on the $SQl line. following is the code : <?php$db = mysql_connect("localhost","root"); mysql_select_db("motorola",$db); $realsdate="$syear"."-"."$smonth"."-"."$stdate"; $realedate="$eyear"."-"."$emonth"."-"."$endate"; $realstime="$shh".":"."$smm"."-"."$sttime"; $realetime="$ehh".":"."$emm"."-"."$entime"; $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 unexpectederror occured. Please go back and book again."); ?> ?? 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/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net