Here is my loop but I don’t know what I should do:
$etiketler = 'tag,tag2,tag3,tag4';
$var = $etiketler;
foreach ($var as $e) {
$keywords_data = array(
'tag_name' => $e,
);
insert('cms_etiketler',$keywords_data);
}
My insert function is:
function insert($table,$data) {
global $db;
$sql = $db->insert($table, $data);
return $sql;
}
I’m using MySQLi db class from here: https://github.com/ajillion/PHP-MySQLi-Database-Class
How can I add these tags into my tags table one by one?
UPDATE:
I found the solution:
$var = preg_split("/[\s,]+/", $etiketler);
I found the solution:
$var = preg_split("/[\s,]+/", $etiketler);
More info : http://www.php.net/manual/en/function.preg-split.php