I have the query below:

$insert2query="INSERT INTO output_search(ref_code, title, author, channel_id) VALUES
            (select  refcode,title, authors, $idquery as cid from chemoJ where title LIKE '%$search%' and refcode NOT IN (select exc_refid_fk FROM exclusions))";

It is giving me an error near the parenthesis, what is wrong with my sintax? I ran the different pieces of the query individually so I could see if the expected results were being returned, and it seems fine. But when I put them all together, it doesn't work.

Thanks in advance.

Try ti without the VALUES keyword, just the select statement.