Files
dumbo2/convert.php
2023-02-23 18:58:41 +01:00

14 lines
596 B
PHP

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