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

android - net_scheduler holding wakelock -

sql - MySQL : Getting Entries from a many-to-many table -

java - Retrieving data from database using jsp (Hibernate + Spring + Maven) -