0

I'm integrating an RSS feed unto my website and i need to create a table:

CREATE TABLE `stories` (
  `id` int(11) NOT NULL auto_increment,
  `title` varchar(255) NOT NULL default '',
  `description` text NOT NULL,
  `when` datetime NOT NULL default '0000-00-00 00:00:00',
  PRIMARY KEY  (`id`)
)

i know how to insert id, title, description but i do not know how to insert the time of the post (user submits them). I used the script given here.

mysql_query("insert into stories (title,description) VALUES ('$_POST[title]','$_POST[description]') ");
1

1 Answer 1

4

For when use the date function:

date('Y-m-d h:i:s')

By default the date function uses the current date/time if you don't supply one as the second argument.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.