Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

81 users online



SQL Error

SQL Error

Currently viewing this thread: 1 (0 members and 1 guests)


thomasemery

thomasemery

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.

Attachments:

structure.txt (Download) 2.92 Kb, 49 views

___________________

There are 10 types of people in the world - Those who understand binary, and those who don't!

xiaodao

xiaodao

Neverside Newbie
Status: Offline!

CREATE TABLE `bookingsCount` (
countid INT(11) NOT NULL auto_increment,
id INT(11) default '0',
PRIMARY KEY (`countid`)
);

try

thomasemery

thomasemery

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!

thomasemery

thomasemery

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!

xiaodao

xiaodao

Neverside Newbie
Status: Offline!

try to use phpmyadmin, i tested the changes in my phpmyadmin, no problem

thomasemery

thomasemery

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!

Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0074 seconds.