I insert data into MySQL using PHP ignore method like this:
if (count($_POST['tags']) > 0)
{
$tags = explode(',', $_POST['tags']);
$quoted_tags = array_map(
function ($x)
{
return "'$x'";
},
$tags);
$string = implode(',', $quoted_tags);
SQL::ACTION("DELETE FROM " . NEWS_TAGS . " WHERE article = ? AND name NOT IN (" . $string . ") ", $id);
$arr_tag = explode(",", $_POST['tags']);
foreach($arr_tag as $tag)
{
$id = $_GET['id'];
SQL::ACTION("INSERT IGNORE INTO " . NEWS_TAGS . " (article, name, type) VALUES (?, ?, ?)", $id, $tag, "news");
}
}
This worked But In MySQL table, between each auto increment id is 4 like This :
How do can I fix this problem?