
March 23rd, 2005
03:49 PM
Neverside Newbie
Status: Offline!
SQL Error
I am getting an sql error which is causing my install script to fail before inserting data.
The error outputted by mysql is:
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '; CREATE TABLE `bookingsCount` ( `id` int(11) NOT NULL
My SQL at this section is:
CREATE TABLE `bookingsCount` (
`id` int(11) NOT NULL default '0',
PRIMARY KEY (`id`)
);
Can anybody spot the problem?
I have included the entire SQL file to make sure that it is not somewhere else.
Many thanks,
Tom.
___________________
There are 10 types of people in the world - Those who understand binary, and those who don't!

March 23rd, 2005
04:18 PM
Neverside Newbie
Status: Offline!
CREATE TABLE `bookingsCount` (
countid INT(11) NOT NULL auto_increment,
id INT(11) default '0',
PRIMARY KEY (`countid`)
);
try

March 23rd, 2005
04:28 PM
Neverside Newbie
Status: Offline!
No, I am afraid that throws up an error too:
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '; CREATE TABLE `bookingsCount` ( countid INT(11) NOT NULL
___________________
There are 10 types of people in the world - Those who understand binary, and those who don't!

March 23rd, 2005
04:35 PM
Neverside Newbie
Status: Offline!
Do you think I would be better off creating each table in a separate SQL file?
___________________
There are 10 types of people in the world - Those who understand binary, and those who don't!

March 23rd, 2005
05:03 PM
Neverside Newbie
Status: Offline!
try to use phpmyadmin, i tested the changes in my phpmyadmin, no problem

March 23rd, 2005
05:05 PM
Neverside Newbie
Status: Offline!
In phpmyadmin the whole script works also, even before the changes. Could this mean a problem with my PHP instead?
Here is the PHP code:
//Creates a persistent connection to the database
$connHBS = mysql_pconnect($mysqlServer, $mysqlLogin, $mysqlPassword);
//Selects the database to work upon
mysql_select_db($mysqlDatabase);
//Reads a file and places content into variable
$sql = implode ('', file('sql/structure.sql'));
//Executes a mysql query
mysql_query($sql,$connHBS);
___________________
There are 10 types of people in the world - Those who understand binary, and those who don't!