Jump to content

[SOLVED] how to find out system date & time?


zgkhoo

Recommended Posts

<?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... :-\

 

 

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() )";

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.