Jump to content

Replacing a URL in an Entir Table, SQL Syntax Problem


Bendensin

Recommended Posts

Hello,

I've changed the category names and URLs for a lot of articles, and now have lots of internal links pointed to the wrong URL. I've done a 301 Redirect, but would like to change all of the URLs in the forum_post table of the database.

I'm trying to replace this:

www.turkeycentral.com/articles/turkey-residence-permit/

with this:

www.turkeycentral.com/turkey/residence-permits/

I used a MySQL query I found on another website and also one from a similar topic in this forum, and ran it through the "SQL" option in PHPMyADMIN:

update forum_posts set post = REPLACE( post,'www.turkeycentral.com/articles/turkey-residence-permit/','www.turkeycentral.com/turkey/residence-permits/' );

Neither are working. It is returning this message:

sql-query.thumb.png.40595a922dc1e2dd49960df8caad46c3.png

So it seems to be running, but affects zero rows. And when I check in the forums, the URLs have not changed.

Would someone please look at the syntax and tell me why it's not working?

 

Link to comment
Share on other sites

Personally, I would have been expecting that query to return a SQL error stating that table forum_posts doesn't exist, as the table is actually forums_posts, and a default IPS 4 db doesn't have a forum_posts table.

So check if you have 2 tables, one called forum_posts and the other forums_posts, and modify your query to target the correct table.

Link to comment
Share on other sites

Thank you Nathan.

I see I have two tables with roughly the same name. The first table is called forum_posts which has 181 rows:

table-1.png.ffedb25f2c879ca2136796b5e6b02828.png

And on the second page of the database, the second table is called iBBS_forums_posts which has over 50,000 rows! I think I found the correct table.

table-2.png.2b832a21d77335249688bc2bef00cc7a.png

Would the first one be from a previous installation perhaps?

Link to comment
Share on other sites

No idea - that's for you to determine.....without knowing the history of your site, it's impossible for me to answer without guessing. The iBBS_ prefix on the correct table implies that forum_posts is nothing to do with a previous install/upgrade.

But the above answers your issue - your correct table is called ibbs_forums_posts, so target that with the query instead.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...