Autor Beitrag
andras
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 460

Win XP, Win Vista Home Premium, Ubuntu Dapper Drake
Delphi 2005 Pers
BeitragVerfasst: Mo 26.02.07 11:41 
hallo!
bitte hilft mir jemand. ich bin nahe am verzweifeln!
was ist an der abfrage falsch:
ausblenden Quelltext
1:
2:
3:
4:
$sql = "INSERT INTO gaestebuch (nickname, email, eintrag, datum) VALUES
  (".$_POST['nickname'].",".$_POST['email'].",".$_POST['eintrag'].",".$zeit.")"; 
$result = mysql_query($sql);
if (!$result) {echo "*mist*e";}

verbindung zur datenbank stehet schon, das funktioniert auch (wird abgefragt).
hoffe irgendwr kann mir sagen was da falsch ist, es wird nähmlich keine fehlermeldung ausgegeben :(
Danke schon jetzt!
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mo 26.02.07 11:50 
Hallo!

Strings müssen in MySQL mit Apostrophs (Apostrophen? Apostrophinen?) umschlossen werden, wie in Delphi auch.

Und nun der dezente Hinweis: PACKE NIEMALS DATEN UNGEPRÜFT IN EIN SQL-QUERY!!

In den $_POST-Dingens kann sonstwas stehen und im Prinzip kann dann jeder mit Deiner Datenbank machen, was er will. Achte zumindest drauf, dass alle Apostropherixe (um eine neue Variante zu benutzen) escaped werden!

Grüße
Christian

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
andras Threadstarter
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 460

Win XP, Win Vista Home Premium, Ubuntu Dapper Drake
Delphi 2005 Pers
BeitragVerfasst: Di 27.02.07 08:37 
ok, danke! jetzt funktionierts!!
Zitat:
Und nun der dezente Hinweis: PACKE NIEMALS DATEN UNGEPRÜFT IN EIN SQL-QUERY!!


dabei bvin ich gerade, danke für den hinweis trotzdem! wollte nur vorher das eintragen hinbekommen.
nochmals danke!
alcaeus
half ontopic starofftopic starofftopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 226



BeitragVerfasst: Di 27.02.07 13:26 
Und pass auf magic_quotes_gpc auf. Das escapt dir die Apostrophobien ( :mrgreen: ) automagisch, was evtl. zu Problemen fuehrt. Deshalb: erstmal stripslashes() ausfuehren, falls magic_quotes_gpc an sind (kann mit get_magic_quotes_gpc() abgefragt werden), und danach mysql_real_escape_string drueberlaufen lassen.

Greetz
alcaeus
andras Threadstarter
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 460

Win XP, Win Vista Home Premium, Ubuntu Dapper Drake
Delphi 2005 Pers
BeitragVerfasst: Mi 28.02.07 11:57 
e klar, hätt ich so oder so gemacht, wollt das nur oben nicht dazugeben, weil das alles dann so viel und verwirrend wird....
aber danke für den hinweis trotzdem!