Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP][MYSQL]Error w zapytaniu sql
Wolfie
post 3.06.2009, 15:35:00
Post #1





Grupa: Zarejestrowani
Postów: 686
Pomógł: 0
Dołączył: 10.11.2008
Skąd: Łódź

Ostrzeżenie: (20%)
X----


Witam, mam takie oto zapytanie :

  1. <?php
  2. $query2 = "CREATE TABLE IF NOT EXISTS customers (
  3.        customers_custnum INT(6) NOT NULL AUTO INCREMENT,
  4.        customers_firstname VARCHAR(15) NOT NULL,
  5.        customers_lastname VARCHAR(15) NOT NULL,
  6.        customers_add1 VARCHAR (50) NOT NULL,
  7.        customers_add2 VARCHAR (50),
  8.        customers_city VARCHAR (50) NOT NULL,
  9.        customers_state CHAR (2) NOT NULL,
  10.        customers_zip CHAR (5) NOT NULL,
  11.        customers_phone CHAR (12) NOT NULL,
  12.        customers_fax CHAR (12),
  13.        customers_email VARCHAR (50) NOT NULL,
  14.        PRIMARY KEY (customers_custnum))";
  15.    
  16.    $customers = mysql_query($query2) or die(mysql_error());
  17. ?>


Ktory wywala taki oto błąd :

Cytat
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 'AUTO INCREMENT, customers_firstname VARCHAR(15) NOT NULL, customers_lastna' at line 2


Tylko ze ja nie widze tam zadnego bledu......

gdy uzywam funkcji error_get_last to pokazuje mi sie tylko 1.

Jak sobei z tym poradzic ?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 1)
skowron-line
post 3.06.2009, 15:44:38
Post #2





Grupa: Zarejestrowani
Postów: 4 340
Pomógł: 542
Dołączył: 15.01.2006
Skąd: Olsztyn/Warszawa

Ostrzeżenie: (0%)
-----


AUTO_INCREMENT


--------------------
I'm so fast that last night I turned off the light switch in my hotel room and was in bed before the room was dark - Muhammad Ali.
Peg jeżeli chcesz uprawiać sex to dzieci muszą wyjść, a jeżeli chcesz żeby był dobry ty też musisz wyjść - Al Bundy.

QueryBuilder, Mootools.net, bbcradio1::MistaJam
http://www.phpbench.com/
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 18.07.2025 - 03:00