I was wondering if it's possible to update multiple tables with one query with mysql. I have tried using INNER JOIN, but I believe that I am off because I continue to get syntax error after syntax error. Below is my current sql syntax:
UPDATE blog_posts a INNER JOIN search b ON a.postTitle = b.title, a.postSlug = b.link, a.postDesc = b.description, a.postCont SET a.:postTitle = b.:postTitle, a.:postSlug = b.:postSlug, a.:postDesc = b.postDesc, a.:postCont WHERE postID = :postID AND title = :postTitle
Here is some background: I have two tables in the same database. One is named blog_posts, and the other search. My blog_posts table contains the content for the blog posts on my website. I recently added a search engine to my site, and added the table search to store all of my pages' data. My idea is that everytime someone updates a blog post, the info in the search table will be updated as well with that same info. I know for a fact that my syntax is off, but I would appreciate if someone could help me get it in tact so that it does what I described above.
Also, my tables each have different column names. blog_posts has the following: postID, postTitle, postSlug (the title converted to a link), and postDesc search has the following: id, title, description, keywords, and link
I have tried to make my script so that it updates the search table row where the postTitle = title. Maybe there's a better way to do this? Anyway, any help would be appreciated.