Forum Moderators: coopster
I`ve done this script and for anyone using it with only one database, I want prefixes before the table names.
$db_prefix = "mw_";
For an example the first table that gets created is called entries.
$query = "CREATE TABLE entries (
id INT(5) NOT NULL auto_increment,
date VARCHAR(40),
caldate DATE NOT NULL,
subject VARCHAR(50) NOT NULL,
message TEXT,
PRIMARY KEY(id)) TYPE=MyISAM";
$result = mysql_query($query);
When I click install, this adds to the database ok. So I changed that to:
$query = "CREATE TABLE " . $db_prefix . " entries (
id INT(5) NOT NULL auto_increment,
date VARCHAR(40),
caldate DATE NOT NULL,
subject VARCHAR(50) NOT NULL,
message TEXT,
PRIMARY KEY(id)) TYPE=MyISAM";
$result = mysql_query($query);
Now what happens is I get the following error message:
You have an error in your SQL syntax near 'entries ( id INT(5) NOT NULL auto_increment, date VARCHAR(40),' at line 1
Can anyone see what the problem is?
Thank you!
I`ve been trying to wrap my head round why this isn`t working and I just keep drawing a blank. I use an e-card script on my site that uses exactly the same method and that works fine.
Strange.