Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [MySQL] Dziwny błąd przy tworzeniu bazy
Max Damage
post
Post #1





Grupa: Zarejestrowani
Postów: 246
Pomógł: 19
Dołączył: 14.06.2007

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


Tak wyglada baza:

  1. <?php
  2. mysql_connect('localhost','user','haslo');
  3. mysql_select_db("nazwa_bazy");
  4.  
  5. $sql="create table forum
  6. nick varchar(16) unsigned not null auto_increment,
  7. haslo char(40) not null,
  8. email varchar(100) not null,
  9. id_artykulu int unsigned not null auto_increment primary key,
  10. temat char(20) not null,
  11. wiadomosc text,
  12. umieszczony datetime not null)";
  13.  
  14. ?>

A taki wyskakuje błąd na stronie:
  1. 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 'unsigned not null auto_increment, haslo char(40) not null, email varchar(100) ' at line 3
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 2)
phpion
post
Post #2





Grupa: Moderatorzy
Postów: 6 072
Pomógł: 861
Dołączył: 10.12.2003
Skąd: Dąbrowa Górnicza




varchar i auto_increment?
Go to the top of the page
+Quote Post
mike
post
Post #3





Grupa: Przyjaciele php.pl
Postów: 7 494
Pomógł: 302
Dołączył: 31.03.2004

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


Przede wszystkim to (cytujac manuala): "there can be only one auto column and it must be defined as a key".
Poza tym dałeś dla pola nick typ varchar i kazałeś mu się automatycznie zwiąkszać. Jak to widszisz? Będą się dodawać literki i podnosić tak jak leci alfebet? (IMG:http://forum.php.pl/style_emoticons/default/tongue.gif)
Go to the top of the page
+Quote Post

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

 



RSS Aktualny czas: 14.09.2025 - 22:44