View Single Post
  #1 (permalink)  
Old Jan 21st, 2008, 12:14
Emzi's Avatar
Emzi Emzi is offline
SuperMember

SuperMember
Join Date: Sep 2007
Location: Manchester
Age: 25
Posts: 153
Thanks: 0
Thanked 0 Times in 0 Posts
[SOLVED] PHP Creat tables in MySQL

Hey all,

I'm trying to create a script for users to go to an install page and click "install" and it will create tables in their database (which they've already provided information for).

At the moment in the PHP code I've written it so it will create two database tables. The problem is it will only create one of them. And bizzarly it installs the table that comes second ('tblAPPLIED').

Here's my code:

PHP: Select all

<?
@mysql_select_db($database_ukjobsite) or die( "Unable to select database");
 
$query "CREATE TABLE `tblADMIN` (
  `admin_id` int(11) NOT NULL auto_increment,
  `admin_username` varchar(25) collate utf8_unicode_ci NOT NULL,
  `admin_password` varchar(25) collate utf8_unicode_ci NOT NULL,
  `admin_level` int(11) NOT NULL default '0',
  PRIMARY KEY  (`admin_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2"
;
 
$query "CREATE TABLE `tblAPPLIED` (
  `applied_id` int(11) NOT NULL auto_increment,
  `first_name` varchar(50) character set utf8 collate utf8_unicode_ci NOT NULL,
  `last_name` varchar(50) character set utf8 collate utf8_unicode_ci NOT NULL,
  `region_id` smallint(5) NOT NULL,
  `telephone` varchar(25) character set utf8 collate utf8_unicode_ci NOT NULL,
  `covernote` text character set utf8 collate utf8_unicode_ci NOT NULL,
  `cv_filename` varchar(255) character set utf8 collate utf8_unicode_ci NOT NULL,
  `date_applied` int(11) NOT NULL default '0',
  PRIMARY KEY  (`applied_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1"
;
 
mysql_query($query);
mysql_close();
?>
Does anyone know where I'm going wrong? Thanks in advance!
Reply With Quote