With the code below, im trying to duplicate a product row with ajax in a webshops table, named termek.
If the last product is ID 90, and i copy this, the new product will be ID 91.
Sometimes, and i dont know why, the ID 90(what i copyed), loose the image, the thumb and big cell in the table, or it is renamed or i dont know what going on.
Is this code okay for copying, or whats wrong whit it?
<?php
include_once("../../files/connect.php");
if(!empty($_POST))
{
$id = mysqli_real_escape_string($kapcs, $_POST['id']);
$sql =
"
INSERT INTO termek
(
termek_nev,
termek_seo,
termek_rovid,
termek_hosszu,
termek_thumb,
termek_big,
termek_seo_title,
termek_seo_rovid,
termek_seo_kw,
termek_status,
termek_view,
termek_akcio,
termek_normal_ar,
termek_akcios_ar,
termek_cikkszam,
termek_egyseg,
termek_fooldal,
termek_kiemelt,
termek_suly,
termek_keszlet_db,
termek_keszlet_warning,
termek_min_order,
termek_allapot,
termek_gyarto,
termek_jobb_arat_btn,
termek_tipus,
termek_szavak
)
SELECT
termek_nev,
termek_seo,
termek_rovid,
termek_hosszu,
termek_thumb,
termek_big,
termek_seo_title,
termek_seo_rovid,
termek_seo_kw,
termek_status,
termek_view,
termek_akcio,
termek_normal_ar,
termek_akcios_ar,
termek_cikkszam,
termek_egyseg,
termek_fooldal,
termek_kiemelt,
termek_suly,
termek_keszlet_db,
termek_keszlet_warning,
termek_min_order,
termek_allapot,
termek_gyarto,
termek_jobb_arat_btn,
termek_tipus,
termek_szavak
FROM termek WHERE termek_id = '$id'
";
if(mysqli_query($kapcs, $sql))
{
echo (int)1;
}
else
{
echo mysqli_error($kapcs);
}
}
?>