I have the following print_r ($array) that I'm trying to insert into a table.
Array ( [0] => 'xxxx', 'xxxx', 'xxxx', 'xxxx' [1] => 'yyyy', 'yyyy', 'yyyy', 'yyyy')
But the script only adds the values of the final row to the table. Can anybody please help? What am I doing wrong here?
Code: Select all
foreach ($array as $values)
{
$query = "insert into xxxxx values (".$values.")";
}
$result = $db->query($query);
if ($result)
echo '<p>'.$db->affected_rows.' records insterted .</p>';
$db->close();