zgkhoo Posted November 3, 2007 Share Posted November 3, 2007 how to find out system date & time? thanks Quote Link to comment Share on other sites More sharing options...
corillo181 Posted November 3, 2007 Share Posted November 3, 2007 echo date(); Quote Link to comment Share on other sites More sharing options...
Barand Posted November 3, 2007 Share Posted November 3, 2007 and provide a format string <?php echo date('Y-m-d H:i:s'); ?> Quote Link to comment Share on other sites More sharing options...
zgkhoo Posted November 3, 2007 Author Share Posted November 3, 2007 wat is the format to save it in mysql DB? DateJoin date, <---this? is it any special format needed in mysql if date combine with time? thanks ... Quote Link to comment Share on other sites More sharing options...
Barand Posted November 3, 2007 Share Posted November 3, 2007 If you only need the date part DateJoin DATE, If you want time element also DateJoin DATETIME, Store them in the format I used in my previous post (omitting the H:i:s if DATE type) Quote Link to comment Share on other sites More sharing options...
zgkhoo Posted November 3, 2007 Author Share Posted November 3, 2007 <?php if(isset($_POST['create_feedback'])){ echo"create feedbak"; $sql = "CREATE TABLE feedback ( FID varchar(10), Topic varchar(50), Message varchar(500), DatePost datetime, UserID varchar(10), Primary Key(FID) )"; mysql_query($sql,$con); } ?> <?php $datepost=date('Y-m-d H:i:s'); //finding the sys date $sql="INSERT INTO feedback (FID,UserID,Topic,Message,DatePost) VALUES ('$FID','1234','$_POST[topic]','$_POST[message]',$datepost)"; mysql_query($sql,$con); ?> still cant... :-\ Quote Link to comment Share on other sites More sharing options...
zgkhoo Posted November 3, 2007 Author Share Posted November 3, 2007 sorry, my mistake ,problem solved thanks no increment to $FID Quote Link to comment Share on other sites More sharing options...
Barand Posted November 3, 2007 Share Posted November 3, 2007 If you want to write the current datetime when inserting you can use MySQL NOW() function. To auto_inc the FID column, write NULL to it $sql="INSERT INTO feedback (FID,UserID,Topic,Message,DatePost) VALUES (NULL, '1234', '$_POST', '$_POST[message]', NOW() )"; Quote Link to comment 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.