Re: cant insert unix timestamp into mysql :( - help!
| From: | Chris Lee | Date: | Fri, 17 Nov 2000 12:16:31 +0000 |
| Subject: | Re: cant insert unix timestamp into mysql :( - help! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-26024@lists.php.net to get a copy of this message | ||
I dont know about your query, it wont work, im almost sure of it. your
try'n to insert "time()" not "12345678" see what I mean.
try
...
echo $query;
...
you'll see what I mean.
$time = time();
$query = "INSERT INTO $usertable VALUES (NULL, '$time',
'$title', '$author', '$dept') ";
will work better.
I usually use getdate()
$date = getdate( $r["time"] );
echo $date["month"];
echo $date["mday"];
just easier to use I find.
Chris Lee
Mediawaveonline.com
In article <20001118040346.727.qmail@web3906.mail.yahoo.com>,
sandeep_wde@yahoo.com wrote:
> Hey ppl,
>
> I've spent half the day on this, and I still can't get it to work. All i
> want is to insert a unix timestamp into mysql, and then pull ut out and
> format it with date function. This is how the code looks so far:
>
> $query = "INSERT into $usertable VALUES (NULL, time()
> ,'$title','$author','$dept')";
>
> but that just puts "0" into the column, which is defined as: time
> int(11) NOT NULL,
>
> what am i doing wrong??
>
>
>
> I intend to print out the data with
>
> echo " $title <br> $author <br> posted by the $dept dept.
> on date ("d M, H:i" ,time());
> ";
>
> If the second bit workable??
>
> thanks for any help!!
>
> /sunny
>
> __________________________________________________
> Do You Yahoo!? Yahoo! Calendar - Get organized for the holidays!
> http://calendar.yahoo.com/
>