mysql - How do you pass multiple sql statements using php -


this question has answer here:

this want lots of records. when try kind of error:the error message get

this currant php , when submit no record added.

$sql = "insert `people` (`id`, `firstname`, `lastname`, `email`, `reg_date`) values (null, 'firstnamea', 'surnamea', 'example1@email.com', current_timestamp);     insert `people` (`id`, `firstname`, `lastname`, `email`, `reg_date`) values (null, 'firstnameb', 'surnameb', 'example@email.com', current_timestamp);     " ; 

however code works adding 1 record

$sql = "insert `people` (`id`, `firstname`, `lastname`, `email`, `reg_date`) values (null, 'tom', 'walker', 'tom@walker.com', current_timestamp); " 

you need duplicate values portion, this:

$sql = "insert `people` (`id`, `firstname`, `lastname`, `email`, `reg_date`)     values (null, 'tom', 'walker', 'tom@walker.com', current_timestamp),     (null, 'bob', 'jones', 'bob@jones', current_timestamp)"; 

Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -