Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Problem z utworzeniem tabeli, Po utworzeniu tabeli wyskakuje ERROR
Rafael6666
post 26.01.2007, 09:53:53
Post #1





Grupa: Zarejestrowani
Postów: 95
Pomógł: 0
Dołączył: 20.10.2006

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


Witam. Mam skrypt wymiany bannerów phpbannerexchange. Kiedy chcę utworzyć tabele, aby skrypt działał wyskakuje błąd:

Kod
Error

SQL query:

CREATE TABLE banneradmin(
id int( 11 ) DEFAULT '0' NOT NULL AUTO_INCREMENT ,
adminuser varchar( 15 ) NOT NULL ,
adminpass varchar( 15 ) NOT NULL ,
PRIMARY KEY ( id ) ,
UNIQUE id( id, adminuser )
);

MySQL said:
#1067 - Invalid default value for 'id'


Jak skasuję auto_increment to tabela tworzy się, ale mogę wtedy utworzyć tylko 1 użytkownika, 1 adres url i 1 administratora, a jak chcem utworzyć więcej, to wyskakuje LOGIN ERROR. Przykład skryptu możecie zobaczyć na stronie www.rufus009.host7.pl. Jeżeli ktoś ma jakiś pomysł i wie jak mi pomóc, to bardzo proszę o napisanie odpowiedzi.

A tu daję kody trzech tabeli, z którymi są problemy:

Kod
CREATE TABLE banneradmin (
   id int(11) DEFAULT '0' NOT NULL auto_increment,
   adminuser varchar(15) NOT NULL,
   adminpass varchar(15) NOT NULL,
   PRIMARY KEY (id),
   UNIQUE id (id, adminuser)
);

INSERT INTO banneradmin (id, adminuser, adminpass) VALUES (1, 'admin', 'pass');


Kod
CREATE TABLE bannerurls (
   id int(11) DEFAULT '0' NOT NULL auto_increment,
   bannerurl varchar(200) NOT NULL,
   uid int(11) DEFAULT '0' NOT NULL,
   PRIMARY KEY (id),
   UNIQUE id (id)
);


Kod
CREATE TABLE banneruser (
   id int(11) DEFAULT '0' NOT NULL auto_increment,
   login varchar(20) NOT NULL,
   pass varchar(20) NOT NULL,
   name varchar(200) NOT NULL,
   email varchar(100) NOT NULL,
   url varchar(200) NOT NULL,
   exposures int(11) DEFAULT '0' NOT NULL,
   credits int(11) DEFAULT '0' NOT NULL,
   clicks int(11) DEFAULT '0' NOT NULL,
   siteclicks int(11) DEFAULT '0' NOT NULL,
   approved tinyint(4) DEFAULT '0' NOT NULL,
   defaultacct tinyint(4) DEFAULT '0' NOT NULL,
   raw blob,
   lastip text NOT NULL,
   PRIMARY KEY (id),
   UNIQUE id (id, login)
);


--------------------
Kompleksowe i profesjonalne tworzenie stron www
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 2)
nospor
post 26.01.2007, 09:56:46
Post #2





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




usun "DEFAULT '0'" z ID i bedzie git.


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

Go to the top of the page
+Quote Post
Cienki1980
post 26.01.2007, 09:57:29
Post #3





Grupa: Przyjaciele php.pl
Postów: 1 590
Pomógł: 40
Dołączył: 11.01.2007
Skąd: Centrum

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


Jak robisz auto_increment nie wpisuj default '0'
Sprawdź bez tego czy zadziała.


--------------------
404
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: 24.07.2025 - 17:06