note 59114 added to function.time
| From: | hasi at hasi dot be | Date: | Sat, 26 Nov 2005 15:11:57 +0000 |
| Subject: | note 59114 added to function.time | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-99150@lists.php.net to get a copy of this message | ||
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..
----
Manual Page -- http://www.php.net/manual/en/function.time.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+59114
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+59114&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+59114&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+59114&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+59114&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+59114&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+59114&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+59114&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+59114&report=yes
Search -- http://master.php.net/manage/user-notes.php