Skip to content

Instantly share code, notes, and snippets.

@gildas-ld
Created April 15, 2022 23:35
Show Gist options
  • Save gildas-ld/f3392f22e625f7e5d39b8a79c119f366 to your computer and use it in GitHub Desktop.
Save gildas-ld/f3392f22e625f7e5d39b8a79c119f366 to your computer and use it in GitHub Desktop.
$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