Login

Member statsTotal: 206Latest: CcardinGuests online: 7Members online: 0
EmailLogin here

Location
ForumHelp & Support • Timestamp

Access: Member
Total posts: 5

Status: Offline
Timestamp Quote 

Hello

How is made the timestamp in the table news30_story ?

I try to insert news by using PHP script.

Thanks.
06:59am 22nd Sep 08  
Access: Admin
Total posts: 174

Status: Offline
Timestamp Quote 

I'm not entirely sure what it is you mean. When you create a new post a timestamp is assigned to it using the PHP time() function.
12:00pm 23rd Sep 08
_______________
Chris - Network-13
Access: Member
Total posts: 5

Status: Offline
Timestamp Quote 

I've made an SQL request like that :

Code:
INSERT INTO news30_story (title, story, shortstory, author, origauthor, avatar, ip, timestamp, catid, allowcomments, short, approved, id)
VALUES ('Title', .... , UNIX_TIMESTAMP(), .... )

but it doesn't work properly.
09:42am 24th Sep 08  
Last edited by Skywalker at 09:43am 24th Sep 08
Access: Admin
Total posts: 174

Status: Offline
Timestamp Quote 

Quote:
I've made an SQL request like that :

Code:
INSERT INTO news30_story (title, story, shortstory, author, origauthor, avatar, ip, timestamp, catid, allowcomments, short, approved, id)
VALUES ('Title', .... , UNIX_TIMESTAMP(), .... )

but it doesn't work properly.

Try this

PHP Code:
<?php
$time
= time();
$sq = "INSERT INTO news30_story (title,story,shortstory,author,origauthor,avatar,ip,timestamp,catid,allowcomments,short,approved)
VALUES
('title',......'$time',......"
;
$query = mysql_query($sql);
?>


Be careful trying to manipulate the database this way as it's very easy to mess things up. Also note that when inserting a new posts you don't need to specify an ID as that field in the table is set to auto_increment and will assign an ID automatically
07:02pm 24th Sep 08
_______________
Chris - Network-13
Last edited by Chris at 07:03pm 24th Sep 08
Access: Member
Total posts: 5

Status: Offline
Timestamp Quote 

Thanks !
07:27am 25th Sep 08  
Post a reply!