0

I have a table DateID just with two fields:

id (integer), date(datetime)

id          date
1           2013-06-27 12:00:00
2           2013-06-27 12:00:00

I need to populate the table with 2 new lines with just one query. Is it possible?

Data:

id =1 date= 2013-06-27 12:00:00;
id =1 date= 2014-06-27 12:00:00;

$insert = mysql_query("INSERT INTO DateID(id,) 
values ('1','20141127120000,20161027120000')");//is this possible? 
4
  • 1
    oh and use mysqli just to be future proof php.net/manual/en/book.mysqli.php :) Commented Nov 12, 2013 at 18:57
  • Be aware that the mysql_*() functions are deprecated and support for them will be removed. For new code use mysqli or PDO. The suggested queries given will still be valid. Commented Nov 12, 2013 at 18:57
  • or use a prepared statement and just repeat the same query with new parameters. Commented Nov 12, 2013 at 18:57
  • mysql bad spam spam spam. Commented Nov 12, 2013 at 18:59

2 Answers 2

5
INSERT INTO DateID(id,date) 
values (1,'20141127120000'),
       (2,'20161027120000')
Sign up to request clarification or add additional context in comments.

Comments

0

You could try this probably?

$insert = mysql_query("INSERT INTO DateID(id, date) VALUES ('1','20141127120000'), ('2', '20161027120000')");

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.