Posts Tagged ‘Database’

What Is FlatPress?

Posted on January 2007 at about 5:00 PM by hwa

I remember that few years back, where people just get to know PHP, and CGI was still ruling the internet, back at that time many web application was using a very special kind of primitive database, called flat-file database.

A flat-file database is a kind of database that is made from text, mean that you can open and see what is inside the database by using any text editor, there’s no complicated SQL command or whatever, just a simple text file, and all your data are stored into this text file. Well, basically that’s the idea.

But of course there’s a drawback with flat-file, a major one is flat-file database is extremely slow.

So what is FlatPress? FlatPress is a version of WordPress that doesn’t require any MySQL database, it use flat-file database to store data. This could be very useful if you are looking for an economic web hosting plan, or you can even find a free web hosting to host your WordPress as long as it support PHP.

According to NoWhereMan, the FlatPress developer, only the simplest plugin will work with FlatPress, however Akismet and some simple theme will still work with FlatPress.

Search And Replace In WordPress Post

Posted on November 2006 at about 12:29 AM by hwa

Upon trying to achieve XHTML 1.0 Strict, one of the thing i found out that i had been doing wrong all this while is that i put target=”_blank” HTML tag in most of my post link, this is not a valid XHTML for Strict and it won’t pass the validation, but i had been doing this since the very first day i blog! It will be troublesome if i’m going to search for every post and take away the target=”_blank”!! So i guess the only way to do this easily is by using the MySQL query, i went to Google around and found this very useful SQL query in Lorelle’s blog.

Before proceed to make any changes to your WordPress database, it’s always a good idea that you backup your database first, who know you might missed out something and screw up your database, it’s always better to prevent than cure right? 😉

Continue with the search and replace, in order to do search and replace in WordPress database, you can use the REPLACE syntax in SQL query, the full line would like the following:

  1. UPDATE wp_posts SET post_content = REPLACE (
  2. post_content,
  3. 'Item to replace here',
  4. 'Replacement text here');

Where wp_posts is your WordPress database post table and post_content is your post content table field, most of the time you don’t need to change this two value.

The thing you need to change is obviously the Item to replace here, which is the text you want to search, it can be multiple string as long as the string is within the single quote, and Replacement text here is the text you want to replace, also can be multiple string as long as it’s within the single quote.

So in my case, i want to strip away target=”_blank” and replace it with nothing, so i do this:

  1. UPDATE wp_posts SET post_content = REPLACE (
  2. post_content,
  3. ' target="_blank"',
  4. '');

Note that the i didn’t put anything for replace string, because i want to delete target=”_blank”, it’s a two single quote.

Again i would like to say, it’s a good practice that you backup your database always, once you screw up your database there is no turning back, and i will take no responsibility if something happen to your database, so do this at your own risk! 🙂