Created
August 10, 2014 00:11
-
-
Save anonymous/3093e9027d05deb1197c to your computer and use it in GitHub Desktop.
Instead of using a loop, you can combine the data into a single database query.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$userData = array(); | |
foreach ($userList as $user) { | |
$userData[] = '("' . $user['first_name'] . '", "' . $user['last_name'] . '")'; | |
} | |
$query = 'INSERT INTO users (first_name,last_name) VALUES' . implode(',', $userData); | |
mysql_query($query); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment