I am trying to insert a string of given tags into a MySQL table, but it’s not quite working out.
$tags = array explode (", ", $_POST["tags"]);
$tag_array = implode(", ", $tags);
My table has the columns tag_id(auto increment) and tag_name(where each item of array needs to go into)
How do I cycle through my array and make MySQL insert a blank value into tag_id (as it’s auto incremented) and each of my array values into the tag_name column?
You don’t mention how you’re accessing MySQL from within PHP, but using PDO you could do something like this: