Created
April 15, 2022 23:35
-
-
Save gildas-ld/f3392f22e625f7e5d39b8a79c119f366 to your computer and use it in GitHub Desktop.
This file contains 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
$sql = 'INSERT INTO users.contacts (firstname, created_at) VALUES (?, ?)'; | |
$query = $db->prepare($sql); | |
$faker = Faker\Factory::create('fr_FR'); | |
$insertedPKs = array(); | |
for ($i = 0; $i < 100; $i++) { | |
$query->bindValue(1, $faker->firstName, PDO::PARAM_STR); | |
// $stmt->bindValue(2, $faker->lastName, PDO::PARAM_STR); | |
$query->bindValue(2, $faker->date("Y-m-d H:i:s"), PDO::PARAM_STR); | |
// $stmt->bindValue(1, $faker->email, PDO::PARAM_STR); | |
$query->execute(); | |
$insertedPKs[] = $db->lastInsertId(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment