- Home
- Categorie
- Coding e Sistemistica
- PHP
- errore nelle tabelle
-
errore nelle tabelle
ciao a tutti e complimenti per il forum ,e da poco che ho intrapreso php e volevo un piccolo aiuto da voi esperti. Ho un libro che non cito dove mi crea delle tabelle del database, ma quando la vado a creare nella query di easyphp
mi da il seguente errore[PHP] Messaggio di MySQL:
#1064 - Errore di sintassi nella query SQL vicino a '\r\n'
(size_id,size_desc);LOAD DATA LOCAL INFILE 'posterstore.data.cardty' linea 3 [/PHP]
pero' vedo che le tabelle:cardtype, orderentry,orders,orderstatus,products,
size,user ci sonoDA QUI
[PHP]CREATE DATABASE PosterStore
DEFAULT CHARACTER SET utf8
DEFAULT COLLATE utf8_general_ci;GRANT CREATE, DROP, SELECT, UPDATE, INSERT, DELETE
ON PosterStore.*
TO 'posters_admin'@'localhost'
IDENTIFIED BY 'posters_admin';GRANT SELECT, UPDATE, INSERT, DELETE
ON PosterStore.*
TO 'posters_user'@'localhost'
IDENTIFIED BY 'posters_user';USE PosterStore;
SET NAMES 'utf8';CREATE TABLE Sizes
(
size_id INTEGER PRIMARY KEY,
size_desc VARCHAR(20) NOT NULL
)
ENGINE = InnoDB;CREATE TABLE Users
(
user_id INTEGER AUTO_INCREMENT PRIMARY KEY,email VARCHAR(200) NOT NULL,
password VARCHAR(200) NOT NULL,name VARCHAR(150) NOT NULL,
company VARCHAR(100),
address1 VARCHAR(150) NOT NULL,
address2 VARCHAR(150),
city VARCHAR(100) NOT NULL,
state VARCHAR(75) NOT NULL,
postal VARCHAR(25) NOT NULL,
country VARCHAR(100) NOT NULL,
phone VARCHAR(25),INDEX(email)
)
ENGINE = InnoDB;CREATE TABLE Products
(
product_id INTEGER AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(150) NOT NULL,
description TEXT,
size INTEGER NOT NULL,
price DECIMAL(6,2) NOT NULL,
thumbnail VARCHAR(50),
FOREIGN KEY (size) REFERENCES Sizes (size_id)
)
ENGINE = InnoDB;CREATE TABLE OrderStatus
(
status_id INTEGER AUTO_INCREMENT PRIMARY KEY,
status VARCHAR(30) NOT NULL
)
ENGINE = InnoDB;CREATE TABLE CardTypes
(
card_id INTEGER PRIMARY KEY,
card_name VARCHAR(50)
);CREATE TABLE Orders
(
order_id INTEGER AUTO_INCREMENT PRIMARY KEY,
customer_id INTEGER NOT NULL,ship_name VARCHAR(150) NOT NULL,
ship_company VARCHAR(100),
ship_address1 VARCHAR(150) NOT NULL,
ship_address2 VARCHAR(150),
ship_city VARCHAR(100) NOT NULL,
ship_state VARCHAR(75) NOT NULL,
ship_postal VARCHAR(25) NOT NULL,
ship_country VARCHAR(100) NOT NULL,
ship_phone VARCHAR(25) NOT NULL,order_cost DECIMAL(6,2) NOT NULL,
ship_cost DECIMAL(6,2) NOT NULL,
total_cost DECIMAL(6,2) NOT NULL,
pmt_type INTEGER NOT NULL,
billing_conf VARCHAR(100),order_status INTEGER NOT NULL,
order_filled_by VARCHAR(100),FOREIGN KEY (customer_id) REFERENCES Users (user_id),
FOREIGN KEY (order_status) REFERENCES OrderStatus (status_id)
)
ENGINE = InnoDB;CREATE TABLE OrderEntry
(
oentry_id INTEGER AUTO_INCREMENT PRIMARY KEY,
order_id INTEGER NOT NULL,
product_id INTEGER NOT NULL,
price DECIMAL(6,2) NOT NULL,
num_units INTEGER NOT NULL,
FOREIGN KEY (order_id) REFERENCES Orders(order_id),
FOREIGN KEY (product_id) REFERENCES Products(product_id)
)
ENGINE = InnoDB;
[/PHP] fino a qui me lo scrivema da qui [PHP]LOAD DATA LOCAL INFILE 'posterstore.data.sizes.mysql'
INTO TABLE Sizes
FIELDS ENCLOSED BY '\libs''
LINES TERMINATED BY '\r\n'
(size_id,size_desc);LOAD DATA LOCAL INFILE 'posterstore.data.cardtypes.mysql'
INTO TABLE CardTypes
FIELDS ENCLOSED BY '\libs''
LINES TERMINATED BY '\r\n'
(card_id,card_name);LOAD DATA LOCAL INFILE 'posterstore.data.orderstatus.mysql'
INTO TABLE OrderStatus
FIELDS ENCLOSED BY '\libs''
LINES TERMINATED BY '\r\n'
(status);LOAD DATA LOCAL INFILE 'posterstore.data.products.mysql'
INTO TABLE Products
FIELDS OPTIONALLY ENCLOSED BY '\libs''
LINES TERMINATED BY '\r\n'
(title, thumbnail, description, price, size);[/PHP] mi da quel errore
mi aiutate , so due giorni che ci provo ma niente
-
Giorgini, se ci siete battete un colpo:x mi sto ad invecchia'