perche se inserisco del time in un campo database timestamp non lo mette?
mi da sempre 0000-00-00 00:00:00Codice PHP:
$data=time()
mysql_query("INSERT INTO tabella (data) values ('$time')");
perche se inserisco del time in un campo database timestamp non lo mette?
mi da sempre 0000-00-00 00:00:00Codice PHP:
$data=time()
mysql_query("INSERT INTO tabella (data) values ('$time')");
Perché la variabile l'hai chiamata $data, non $time
no scusa è stato un errore mio di battitura:
e da quel problema.Codice PHP:
$data=time()
mysql_query("INSERT INTO tabella (data) values ('$data')");
ecco vi posto il code completo:
Codice PHP:
$datainvio=time();
$sql="INSERT INTO boxmessage (IDMsg, IDUtenteSent, IDUtenteReciver, Oggetto, Messaggio, Stato, DataInvio) values ";
$sql.="('$idmsg', '$_COOKIE[IDUtente_Network]', '$idutentereciver', '$object', '$message', '0', '$datainvio')";
mysql_query($sql);
time() restituisce un timestamp in stile UNIX, ovvero un intero che rappresenta il numero di secondi dal 1/1/1970, quindi non è in formato aaaa-mm-dd hh:mm:ss
fa così e vedi che dovrebbe andare
$datainvio = date('Y-m-d H:i:s',time());
un ultima cosa è possibile aggiungere un elemento ad un array e metterlo in prima posizione?
Codice PHP:
$elemento_da_inserire = array($elemento);
$array_esistente = array_merge($elemento_da_inserire,$array_esistente);