Many people, including me have troubles using a multisite feature of the recently released WordPress 3.0. I wanted to merge all my sites and to use subdomains (directories) for the address of each site (e.g. my.blog.com instead of blog.com/my). In order to create subdomains, WordPress requires us to create a wildcard subdomain. However, wildcard subdomains are not supported on Bluehost, where my site is currently hosted at. So, after searching for information on the net, I found that there are two workarounds that we can do in order to get our WordPress 3.0 multisite working:

Option 1

Subdomain Option 1
Create a subdomain on Bluehost’s CPanel, and point the document root to /public_html/. Then create a new site on WordPress with the same subdomain name as the one you create on the CPanel. Simple!

Option 2

Subdomain Option 2
Create a wildcard subdomain (*) on Bluehost’s CPanel, and point the document root to /public_html/. Some people reported that this indeed worked! By creating this wildcard domain, you are allowed to use any domain names you like (visitors can still type in any random subdomains and they will still end up in your main site! Awesome, huh?). But one thing to be aware of is that, you need to set up redirects through ModRewrite or scripting if you don’t want some subdomains to link to your WordPress files.

I personally prefer the first option (and I have tested this, and it works!), since I only use this website for myself and I don’t add new sites on WordPress very often. Well, it’s up to you 🙂

Auto-increment is a very useful feature that allows a unique number to be generated when a new record is inserted into a table. The DBMS will automatically increment the last number of the table and add it to the auto-incremented column. Unfortunately, different DBMSs use different ways or syntax to do this. In this post, I will show you how to include the auto-increment feature in MySQL, Microsoft SQL Server, and Oracle.

Auto-Increment in MySQL

CREATE TABLE Students (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
fullname VARCHAR(80) NOT NULL
);

As you can see from the above code, the auto-increment feature is very simple when it’s applied in MySQL. You only need to add auto_increment as shown in line 2. By default, the auto_increment value starts at 1. If you want the auto_increment to start with value other than 1, you have to set that value using ALTER TABLE:

ALTER TABLE Students AUTO_INCREMENT=2000

Continue reading

I collected these SQL scripts so that whenever I want to check the existency of a table, view, stored procedure, or function in a database, all I have to do is to copy and paste them to the Query Analyzer. FYI, These scripts are only used for SQL Server 🙂 . Hope it’s useful!

Check if the table exists in a database:

IF EXISTS
(
  SELECT * FROM dbo.sysobjects
  WHERE id = object_id(N'[dbo].[enterTableNameHere]')
         AND OBJECTPROPERTY(id, N'IsUserTable') = 1
)

DROP TABLE [dbo].[enterTableNameHere]

GO

Continue reading

I rely on these websites when it comes to designing websites. So, this is a time for me to share them with you. Hope it is useful.

Graphics & Stock Photos

Continue reading