mysql - How do you pass multiple sql statements using php -
this question has answer here:
- php/mysql multiple queries 3 answers
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
Post a Comment