rp7;11024775 wrote:this did not do the trick!
How so? what were your results?
rp7;11024775 wrote:And so I have described the two relevant tables
what about the [font=monospace]posts[/font] table?
. . .
You could probably use your current statement if you made the post_id + tag_id combination a primary key, and used INSERT IGNORE:
CREATE TABLE `post_tag` (
`post_id` int(11) NOT NULL,
`tag_id` int(11) NOT NULL,
PRIMARY KEY( `post_id`,`tag_id` )
)
$query = "INSERT IGNORE INTO post_tag( post_id,tag_id )
SELECT post_id,tag_id
FROM posts
INNER JOIN tag
WHERE username = '$username'
AND tag IN( '$music','$sport','$tech' )";
...not saying that that's the best solution, but it should solve your immediate problem.