Jump to content

[SOLVED] how to enter current datetime


dadamssg

Recommended Posts

im trying to make a column that has the current datetime the row was created...this isn't working, any help would be greatly appreciated :)

 

$today = time();

$cxn = mysqli_connect($host,$user,$passwd,$dbname)
         or die("Couldn't connect"); 

$sql = "INSERT INTO test (title, description,location, event, created, start, end, createdby)
VALUES ('{$_SESSION['title']}','{$_SESSION['description']}','{$_SESSION['location']}'
         ,'{$_SESSION['event']}','{$today}', '{$_SESSION['starts']}', '{$_SESSION['ends']}', '{$_SESSION['logname']}')";

Link to comment
https://forums.phpfreaks.com/topic/147369-solved-how-to-enter-current-datetime/
Share on other sites

sorry :/

 

$today = date("Y-m-d H:i:s");

$cxn = mysqli_connect($host,$user,$passwd,$dbname)
         or die("Couldn't connect"); 

$sql = "INSERT INTO test (title, description,location, event, created, start, end, createdby)
VALUES ('{$_SESSION['title']}','{$_SESSION['description']}','{$_SESSION['location']}'
         ,'{$_SESSION['event']}','{$today}', '{$_SESSION['starts']}', '{$_SESSION['ends']}', '{$_SESSION['logname']}')";

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.