Toon posts:

[MySql] auto nummering

Pagina: 1
Acties:

Verwijderd

Topicstarter
INSERT INTO artist (id, artist) VALUES ('','A Day at the Beach Slots')
INSERT INTO artist (id, artist) VALUES ('','A Fork in the Tale')

wanneer ik dit doe zodat ik niet telkens een cijfer er voor moet zetten gaat het fout.

MySQL retourneerde: You have an error in your SQL syntax near 'INSERT INTO artist (id, artist) VALUES ('','A Fork in the Tale') INSERT INTO a' at line 2

iemand een manier omdat dit wel te doen??

  • Dennis
  • Registratie: Februari 2001
  • Laatst online: 15:14
maak van '' NULL

  • Zoijar
  • Registratie: September 2001
  • Niet online

Zoijar

Because he doesn't row...

nee, '' werkt perfect. heet je tabel misschien artistS? Of wat het kan zijn is dat je tabel hoofdletters bevat, bv. Artist ip artist.

  • SJR
  • Registratie: Januari 2000
  • Laatst online: 15-02 13:58

SJR

En als je dit probeert?
INSERT INTO artist (artist) VALUES ('A Day at the Beach Slots')
INSERT INTO artist (artist) VALUES ('A Fork in the Tale')

Verder neem ik aan dat de column id wel autonummering aan heeft staan? Dat gaat niet vanzelf namelijk...

Verwijderd

SJR heeft volgens mij gelijk. De kolom moet "auto_increment" hebben en dan hoef je geen waarde meer op te geven als je een record toevoegt. Dat doet hij dan namelijk zelf :)

  • Janoz
  • Registratie: Oktober 2000
  • Laatst online: 17-09 22:25

Janoz

Moderator Devschuur®

!litemod

Als ik die foutmelding zo zie, dan lijkt het alsof je beide statements tegelijk uitvoert. Als dat zo is zou het kunnen helpen om er een ; tussen te zetten.

Ken Thompson's famous line from V6 UNIX is equaly applicable to this post:
'You are not expected to understand this'


Verwijderd

Topicstarter
auto_increment staat aan.

maar als ik die code wil toevoegen doet die het gewoon niet!

Verwijderd

Topicstarter
maar als ik


INSERT INTO artist (id, artist) VALUES ('','A Day at the Beach Slots')

toevoeg doet die het wel maar meerdere niet!!

en doe ik dit

INSERT INTO artist (artist) VALUES ('A Day at the Beach Slots')
INSERT INTO artist (artist) VALUES ('A Fork in the Tale')

dan!

MySQL retourneerde: You have an error in your SQL syntax near 'INSERT INTO artist (artist) VALUES ('A Fork in the Tale')' at line 2

  • ACM
  • Registratie: Januari 2000
  • Niet online

ACM

Software Architect

Werkt hier

En een ; tussen die regels?
Pagina: 1