2
I have a problem to give INSERT in PHP. I have a table called products_1 and another one called products_2. Table 1 has the same products as the second one, but with 5 more products, i.e., ID 11, 12, 13, 14 and 15 are not included in products_2. I need to "copy", insert this 5 products, at once, in products_2. And every time there are more products in the products_1.
I TRIED THAT, BUT HE ONLY INSERTS ID 15, THE LAST >
if (!$db->Query("SELECT * FROM produtos_2 ORDER BY id DESC LIMIT 1"))
$db->Kill();
while (! $db->EndOfSeek()) {
$row = $db->Row();
$idprodutos2= $row->id;
}
mysql_query("INSERT INTO produtos_2 SELECT * FROM produtos_1 WHERE id > '.$idprodutos2.'");
"Let’s go to the head together"
If you need to keep the two tables identical, it would not be better to use a Trigger within the database?
– Paulo Santos