convert.php 596 B

12345678910111213
  1. <?php
  2. $old = mysqli_connect("localhost","daniel", "ncc74656", "dumbo");
  3. $new = new PDO('mysql:host=localhost;dbname=dumbo2', "daniel", "ncc74656");
  4. $query = $old->query("SELECT * FROM `film_votes`");
  5. $target = $new->prepare("INSERT INTO `votes` (`id`, `user`, `film`, `vote`, `created_at`, `updated_at`) VALUES (?, ?, ?, ?, ?, ?); ");
  6. //$settings = $new->prepare("INSERT INTO `settings` (`user`, `key`, `value`) VALUES (?, ?, ?);");
  7. foreach($query->fetch_all(MYSQLI_ASSOC) as $q) {
  8. $target->execute([$q['id'], $q['user'], $q['film'], $q['stimme'], $q['created_at'], $q['updated_at']]);
  9. }