Manipulating MySQL

Manipulating MySQL databases might not be everyone’s idea of a fun thing to do, but when you have your own self hosted blog and access to cPanel, then you can use a great program called phpMyAdmin to do your manipulating without having to know a single MySQL command or query.

Say, for instance you created a series of posts and then discovered that you wanted to add an important one in the middle of them all. Well, the usual way would be to write then new post and have it out of sequence later on in the blog’s list of posts.

But what if you wanted to place it in between two existing posts?

You couldn’t do that from withing your WordPress panel, but you can do some nifty manipulation from within phpMyAdmin with your posts to achieve that effect.

It does involve a bit of work, but not too much if you concentrate on what you’re doing, because when you play with this little baby, any mistakes are final and irretrievable!

So, strap yourself in and we’ll begin!

First you’ll need to take the first post after your series and move it to the end. You can do that from within WordPress by simply copying all the text and pasting it into a new post along with the title and hitting publish.

Now you have an extra post that you can use for manipulation. If you want to insert your new post in the middle of your series, then you’ll have to shunt them all up one starting with the last to fill your derelict post, then each preceding post. Here’s how.

Go into phpMyAdmin and find the derelict post and clear out it’s body text (post_content). Now copy and paste all the data from the preceding post into it, including date and timestamps but leave the ID intact. Hit GO. That’s updated.

Go to the preceding post and delete all the text from that and copy and past the text and details from the preceding post into that one. Hit GO as before.

Do the same until you reach the place where you want to insert your extra post. Simply copy and past your new post into the empty file, change it’s title (post_name) to match the title you have given it and also its GUID. Then hit GO as before and go and look at your blog.

You should see all the posts in their new order and the permanent links should all match up too.

Easy? Well, not really, but if you’re desperate to do something like this, it’s nice to know there is a way, even if it is a bit complex!

Terry Didcott
Make Money Online