I-AM-OBODO Posted July 16, 2008 Share Posted July 16, 2008 i wrote a form, but each time the form is submitted, the day and time dont show. why is it so or maybe i did something wrond Quote Link to comment https://forums.phpfreaks.com/topic/114953-solved-php-insert-date/ Share on other sites More sharing options...
sader Posted July 16, 2008 Share Posted July 16, 2008 give some code Quote Link to comment https://forums.phpfreaks.com/topic/114953-solved-php-insert-date/#findComment-591221 Share on other sites More sharing options...
I-AM-OBODO Posted July 16, 2008 Author Share Posted July 16, 2008 <?php $date = date; $fname=$_REQUEST['fname']; $lname=$_REQUEST['lname']; $member_num=$_REQUEST['member_num']; $amt_buy=$_REQUEST['amt_needed']; $email=$_REQUEST['email']; $phone=$_REQUEST['phone']; $address=$_REQUEST['address']; $db="mydatabase"; $link = mysql_connect("localhost", "user", "password"); if (! $link) die("Couldn't connect to MySQL"); mysql_select_db($db , $link) or die("Couldn't open $db: ".mysql_error()); mysql_query ("INSERT INTO members (fname, lname, member_num, amt_needed, email, phone, address, date_of_order) VALUES ('$fname','$lname','$egold_num', '$amt_buy', '$email','$phone', '$address', '$date')"); mysql_close($link); ?> all i get is 0000-00-00 on the colum am expecting a date. thank you Quote Link to comment https://forums.phpfreaks.com/topic/114953-solved-php-insert-date/#findComment-592040 Share on other sites More sharing options...
I-AM-OBODO Posted July 16, 2008 Author Share Posted July 16, 2008 thanks guys, i already figured out what was wrong. i just added the CURDATE() function and wala! it did the magic Quote Link to comment https://forums.phpfreaks.com/topic/114953-solved-php-insert-date/#findComment-592063 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.