Glad it is now working.

BTW, what do you get from the following query?
Code:
SELECT count(*),max(site_id) FROM sites;
The site_id column of the sites table is set as follows:
Code:
site_id mediumint(9) NOT NULL auto_increment
Maybe your blanks were because you are out of auto_increment numbers?
Hmm...