Save date and time in database

Asked

Viewed 1,395 times

0

I wonder if there is how I save the date and time of my system to be able to save in the database, I would not like to create a "created_em" and add the time in the database, what I want to do is more "complex" I believe, I am trying here but I did not succeed.

What I want to save

$emailarquivo = $_POST['email'].$_POST['datetime'];
$nome_final = $emailarquivo;   

How I’m gonna put it in the bank

$query = "INSERT INTO contato (`nome`,`caminho`) VALUES ('".$nome_final."', '".$_UP['pasta']."')";

I’ve tried with the name in place of datetime and it works, it sends the name and the email in the same column, but how would you pass the date and time?

  • what’s $endname = $emailarquivo; why not VALUES ('". $emailarquivo." '

  • It’s so I can organize better, we use a pattern where I work. So datetime is not passed, I wonder if there is any way to get the system, datetime is just an "example" of how it would be.

  • I already got it, I don’t need to take the data for a $_POST

  • Strange then this $_POST

1 answer

0


Solution :

Alter

$emailarquivo = $_POST['email'].$_POST['datetime'];

To

$emailarquivo = $_POST['email'].$date = date('Y-m-d H:i:s');
  • that there, the $_post confused the understanding of the question

  • Yes, it’s just that whenever I handle data I pick up from the customer or somewhere else I usually use the $post..

Browser other questions tagged

You are not signed in. Login or sign up in order to post.