note 59114 rejected from function.time by dmytton
| From: | dmytton@php.net | Date: | Sat, 26 Nov 2005 22:07:57 +0000 |
| Subject: | note 59114 rejected from function.time by dmytton | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-99158@lists.php.net to get a copy of this message | ||
Note Submitter: hasi at hasi dot be
----
Hi,
I'm using the time() function to attach the 'time' when a message, which I want to
put on my website, was created (I've constructed a Flash-made bulletin board, which i can
update at any time using the admin.php-file) The admin.php-file looks like this:
---------------------------
<?php
$dbhost = "localhost";
$dbuser = "username";
$dbpass = "pass";
$dbname = "dbname";
//connect
$open = mysql_connect($dbhost, $dbuser, $dbpass) or die(mysql_error());
mysql_select_db($dbname) or die(mysql_error());
$mode = $_GET["mode"];
if($mode == "insert"){
$onderwerp = $_POST["onderwerp"];
$bericht = $_POST["bericht"];
This is the one!!! $datum = time(); !!!
$query = mysql_query("INSERT INTO nieuws (onderwerp, bericht, datum) VALUES
('$onderwerp', '$bericht', '$datum')") or die (mysql_error());
if($query){
$result = "<hr/><p>Het nieuwsbericht is opgeslagen!</p><hr/>";
}else{
$result = "<hr/><h3>Error!</h3> <p>Het nieuwsbericht is niet
opgeslagen!</p><hr/>";
}
}
echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>";
?>
----------------------------
It is in fact rather simple but it just doesn't want to work. My butlletin board always shows
the 'starting date': 01 January 1970. Anyone knows what could be wrong?? Thanks..