I am trying to select data from one table and insert it into an existing table using PHP.
While i understand that i could just collect the results into an array and then re-inject them into the correct table this seems inefficient. I must be able to just copy the requested query into a table of my choosing.
Any guidence would be much appreciated. Below is how i would put data into an array.
<?php
header("Cache-Control: no-cache");
date_default_timezone_set('Europe/London');
// open DB connection
require_once("DbConnect.php");
// fetch playlist
$result = $db->query(
"SELECT `artist`, `title`, `label`, `albumyear`, `date_played`, `duration`, `picture` "
."FROM historylist ORDER BY `date_played` DESC LIMIT 5 ");
// put into array
while ($row=$result->fetch_object()) $list[] = $row;
?>