Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [mysql] auto_increment przestal dzialac :|
-Gość-
post 5.07.2006, 14:58:06
Post #1





Goście







mam kod mysql-a:

  1. CREATE TABLE `xxx` (
  2. `id` int(11) NOT NULL AUTO_INCREMENT,
  3. `nazwa` varchar(255) NOT NULL,
  4. PRIMARY KEY (`id`)
  5. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;


teraz gdy dodaje zapytanie SQL:

  1. INSERT INTO `xxx` ( `id` , `nazwa` )
  2. VALUES (
  3. '', 'test'
  4. )


MySQL zwraca komunikat:
#1264 - Out of range value adjusted for column 'id' at row 1


tak jakby w mysqlu auto_increment przestal dzialac :|||||||||| co jest bez sensu bo wczoraj ejszcze dzialal ;/

moja ver mysqla to: 5.0.22-community-nt
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 4)
-Gość-
post 5.07.2006, 15:11:30
Post #2





Goście







znalazlem cos takiego:
http://forums.eqdkp.com/lofiversion/index.php/t3101.html

czyli musze zrezygnowac z przypisywania id ? :| a mzoe jest jakis sposob aby w zapytaniu sql mysql sam pobral pierwsze wolne id i przypisal ?
Go to the top of the page
+Quote Post
Cysiaczek
post 5.07.2006, 15:14:52
Post #3





Grupa: Moderatorzy
Postów: 4 465
Pomógł: 137
Dołączył: 26.03.2004
Skąd: Gorzów Wlkp.




Error

Varchar ma 255 znaków, a ile ma słówko 'test' questionmark.gif'

Ten post edytował Cysiaczek 5.07.2006, 15:14:11


--------------------
To think for yourself you must question authority and
learn how to put yourself in a state of vulnerable, open-mindedness;
chaotic, confused, vulnerability, to inform yourself.
Think for yourself. Question authority.
Go to the top of the page
+Quote Post
-Gość-
post 5.07.2006, 15:22:00
Post #4





Goście







Cytat(Cysiaczek @ 5.07.2006, 15:14 ) *
Error

Varchar ma 255 znaków, a ile ma słówko 'test' questionmark.gif'


to raczej nie powodowalo bledu :|

ale problem juz calkowicie rozwiazany.. poprostu w mysqlu w ver >=5.x nie mozna dawac zadnej wartosci gdy pole ma wlasciwosc auto_increment

wiecej:
http://dev.mysql.com/doc/refman/5.0/en/exa...-increment.html

wiec ten kod wystarczy zamienic na:

INSERT INTO `xxx` ( `nazwa` )
VALUES (
'test'
)

i bedzie dzialac ;-)

chybam, ze cos robie nei tak.. snitch.gif

dziwi mnie tylko to dlaczego wczoraj wszystko to dzialalo a dzis juz nie haha.gif
Go to the top of the page
+Quote Post
Cysiaczek
post 5.07.2006, 15:22:50
Post #5





Grupa: Moderatorzy
Postów: 4 465
Pomógł: 137
Dołączył: 26.03.2004
Skąd: Gorzów Wlkp.




o.0 smile.gif


--------------------
To think for yourself you must question authority and
learn how to put yourself in a state of vulnerable, open-mindedness;
chaotic, confused, vulnerability, to inform yourself.
Think for yourself. Question authority.
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: 14.08.2025 - 03:34