I have have a multi-select feature which allows the user to tag a company with services. And in my database I have a table with just id and names of those services. What I am trying to do is create a statement that searches to see if the tag already exists, if it does not exist, create it. Could someone help me with the logic of setting this up?
I am just not sure how to go about searching through a table column with an array.
Thanks
$company_type = implode(',', $company_type);
$lookup_tags = "SELECT * FROM table WHERE company_type_id = ?";
$q_lookup_tags = $conn->prepare($lookup_tags);
$q_lookup_tags -> execute(array($company_type));
How do I perform the select and sort the results into existing and non existing ids?
Thanks