-
-
Save bytefade/d00fb897c6a8c0d91b09 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