Forum Home
Press F1
 
Thread ID: 106365 2010-01-05 23:14:00 MySQL Please Help! diggakid (15268) Press F1
Post ID Timestamp Content User
846161 2010-01-05 23:14:00 Hello i have just started learning PHP and MySQL and have taken up my 3rd project which is starting to heavily rely on the MySQL database to store information.

Im coding a shopping cart for personal use and have made a .sql document to create the database and tables for me but when i load the script via phpmyadmin and error keeps stopping me from creating the tables.

im testing the scripts on a local host

please help

here is my script:


create database cart_sc;

use cart_sc;

create table customer_details
(
order_number int unsigned not null auto_increment primary key,
first_name char(60) not null,
last_name char(60) not null,
address char(80) not null,
city char(30) not null,
state char(20) not null,
zip varchar(10) not null,
country char(20) not null,
email varchar(100) not null,
phone int(20) not null,
);

create table orders
(
order_number int unsigned not null auto_increment primary key,
date date not null,
order_status char(10) not null,
server_name char(60) not null,
server_type char(255) not null,
server_slots char(30) not null,
server_brand char(20) not null,
total_price float(4,2) not null,
);

grant select, insert, update, delete
on cart_sc.*
to cart_sc@localhost identified by 'password';
diggakid (15268)
846162 2010-01-06 00:27:00 What does the error say Morgenmuffel (187)
846163 2010-01-06 00:40:00 create table customer_details
(
order_number int unsigned not null auto_increment primary key,
first_name char(60) not null,
last_name char(60) not null,
address char(80) not null,
city char(30) not null,
state char(20) not null,
zip varchar(10) not null,
country char(20) not null,
email varchar(100) not null,
phone int(20) not null, <<---- Extra Comma here.
);

Remove that and it works. Repeat for all other table where you have a comma after the last field.
HAL9000 (12736)
846164 2010-01-06 08:27:00 Also - why are you using the char datatype in most of those fields? Varchar is usually a better choice for that kind of data. Erayd (23)
1