WCM Forum

WCM Forum (http://www.wcm.at/forum/index.php)
-   Programmierung (http://www.wcm.at/forum/forumdisplay.php?f=17)
-   -   MySQL - Select (http://www.wcm.at/forum/showthread.php?t=41851)

The_Beax 05.01.2002 15:41

MySQL - Select
 
Hallo Leute!

Ich habe (wieder) ein Problem mit MySQL/PHP:

Der Befehl: "INSERT INTO user (id, name, real_name, group) VALUES('1', 'test', 'test', '0')"

liefert mir nur den Fehler: "1064: You have an error in your SQL syntax near 'group) VALUES('1', 'test', 'test', '0')' at line 1"

Die Tabellen exisistieren natürlich und ich bin auch mit dem Server und der Datenbank verbunden. Wenn ich die Tabelle "group" weglasse funktioniert es!

MfG
Martin

Gonte 06.01.2002 14:41

ist group vom type her zufällig eine zahl?

zend 06.01.2002 14:54

(id, name, real_name, group) VALUES('1', 'test', 'test', '0')"
sieht man ja das group a zahl ist.(0)
probier group mit value 'test'

The_Beax 06.01.2002 15:03

Hallo!

Das Feld "group" ist ein Text. Die Gruppen werden durch ein ";" getrennt gespeichert ("1;0;100;..."). Also bei einer Gruppe ist folglich nur eine Zahl dort.

MfG
Martin

The_Beax 06.01.2002 15:08

@zend
phpMyAdmin bricht mir mit einen Error wenn ich für das Feld "group" einen value Wert einsetzen will.

MfG
Martin

_m3 06.01.2002 21:38

OK - hab mal nachgeschlagen. Du "darfst" zwar reservierte Worte als Spaltennamen verwenden, es wird aber nicht empfohlen. Bennene die Spalte in "Gruppe" um, und es wird alles sofort funktionieren. Bei mir hat er schon beim erstellen einer Spalte mit dem Namen "group" auf der Kommandozeile eine Fehlermeldung geschoben. phpMyAdmin dürfte da etwas "lockerer" mit dem Problem umgehen.

Zitat:

A common problem stems from trying to create a table with column names that use the names of datatypes or functions built into MySQL, such as TIMESTAMP or GROUP. You're allowed to do it (for example, ABS is an allowed column name), but whitespace is not allowed between a function name and the `(' when using functions whose names are also column names.
http://www.mysql.org/doc/R/e/Reserved_words.html

The_Beax 07.01.2002 21:34

danke _m3


Alle Zeitangaben in WEZ +2. Es ist jetzt 14:17 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© 2009 FSL Verlag