Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

SQL syntax Error on Database Upload

Codes here !

Moderators: macek, egami, gesf

SQL syntax Error on Database Upload

Postby griff » Fri Feb 14, 2003 3:25 pm

First of all I'm not a database guy...I'm a web designer..the db admin is out of pocket and the server died...now I'm left to reload the db. Maybe someone can help me.

After the server came back up, mysql running I tried using the dump utility from the myphpadmin area to reload the database from an uzipped backup file.

I'm receiving the following error...also including the code I think is generating the error... I don't have a clue what it is referring to

error:
mySQL said:
You have an error in your SQL syntax near 'references varchar(127) NOT NULL default '',
PRIMARY KEY (company_id),
KEY' at line 16

Code:
DROP TABLE IF EXISTS companies;
CREATE TABLE companies (
company_id int(10) unsigned NOT NULL auto_increment,
category_id int(10) unsigned NOT NULL default '0',
name varchar(39) NOT NULL default '',
slogan varchar(255) NOT NULL default '',
address varchar(63) NOT NULL default '',
phone varchar(31) NOT NULL default '',
fax varchar(31) NOT NULL default '',
email varchar(127) NOT NULL default '',
web varchar(127) NOT NULL default '',
about varchar(127) NOT NULL default '',
directions varchar(127) NOT NULL default '',
logo char(0) NOT NULL default '',
priority enum('#1','#2','#3','#4') NOT NULL default '#3',
coupons varchar(127) NOT NULL default '',
references varchar(127) NOT NULL default '',
PRIMARY KEY (company_id),
KEY category_id(category_id),
KEY name(name),
KEY priority(priority)
) TYPE=MyISAM;



Thanks RSG
griff
New php-forum User
New php-forum User
 
Posts: 3
Joined: Thu Oct 24, 2002 5:30 pm

Postby Redcircle » Sat Feb 15, 2003 9:20 am

You cannot have an enum value as a key and references is a value you cannot use as a field name. So if you changed references to just refer and removed priority as a key it would work.
User avatar
Redcircle
Moderator
Moderator
 
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA


Return to mySQL & php coding

Who is online

Users browsing this forum: Bing [Bot] and 3 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron