Autor Beitrag
JungerIslaender
ontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 427
Erhaltene Danke: 5

Win XP
Delphi 7; Delphi 2005
BeitragVerfasst: So 30.08.09 23:08 
Vorweg ich hab keine Ahnung. ^^

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
  $bestellung = $_POST["Bemerkungen"];
  $time = time();
  $time = date("H:i",$timestamp);
  $date = date("d.m.Y",$timestamp);

  $eintrag = "INSERT INTO konten WHERE user = $username; (bestellung, bestelldatum, bestellzeit) VALUES ('$bestellung', '$date', '$time')";
  $eintragen = mysql_query($eintrag);


funktioniert nicht ka warum. Login in db läuft hole andere daten aus der db. es wird einfach nix eingetragen und schon einiges probiert. Komm einfach nicht weiter.

Moderiert von user profile iconNarses: Titel geändert, war: "Wo ist der Fehler???(php)"
Moderiert von user profile iconChristian S.: Topic aus Off Topic verschoben am Mo 31.08.2009 um 20:20
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: So 30.08.09 23:19 
Was soll dieser Code machen?
Ich vermute mal eine neue Zeile einfügen, aber was soll drinstehen?

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: So 30.08.09 23:50 
user profile iconJungerIslaender hat folgendes geschrieben Zum zitierten Posting springen:
Vorweg ich hab keine Ahnung. ^^

Vorweg: das sieht man. ^^

user profile iconJungerIslaender hat folgendes geschrieben Zum zitierten Posting springen:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
  $bestellung = $_POST["Bemerkungen"];
  $time = time();
  $time = date("H:i",$timestamp);
  $date = date("d.m.Y",$timestamp);

  $eintrag = "INSERT INTO konten WHERE user = $username; (bestellung, bestelldatum, bestellzeit) VALUES ('$bestellung', '$date', '$time')";
  $eintragen = mysql_query($eintrag);

Versuchs mal mit Lesen aus Variablen, die's auch gibt ...

Und wie im anderen Thread bereits erwähnt: Escaping und Prepared Statements bitte dringend verwenden!

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
DeddyH
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 31.08.09 11:04 
Vielleicht sollte man zuallererst einmal die SQL-Syntax einhalten.
ausblenden SQL-Anweisung
1:
INSERT INTO Tabelle(Feldliste) VALUES(Wertliste)					

Beim INSERT gibt es keine WHERE-Klausel (wozu auch?). Und wenn es eine gäbe, würde sie ans Ende des o.a. Statements gehören.
JungerIslaender Threadstarter
ontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 427
Erhaltene Danke: 5

Win XP
Delphi 7; Delphi 2005
BeitragVerfasst: Mo 31.08.09 16:07 
Der code soll folgendes machen: Bestellung, datum, zeit in die tabelle konten bei einem bestimmten user reinschreiben. Durch den vorherigen Post, denke ich das ich statt insert dann wohl update nehmen muss.

Werde es auch direkt versuchen und mein Ergebnis posten.
Regan
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2157
Erhaltene Danke: 72


Java (Eclipse), Python (Sublimetext 3)
BeitragVerfasst: Mo 31.08.09 16:15 
user profile iconDeddyH hat folgendes geschrieben Zum zitierten Posting springen:
Vielleicht sollte man zuallererst einmal die SQL-Syntax einhalten.
ausblenden SQL-Anweisung
1:
INSERT INTO Tabelle(Feldliste) VALUES(Wertliste)					

Nicht zwingend, siehe MySQL Dokumentation.
DeddyH
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 31.08.09 16:18 
Da kann ich von einer WHERE-Klausel trotzdem nichts entdecken.
Regan
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2157
Erhaltene Danke: 72


Java (Eclipse), Python (Sublimetext 3)
BeitragVerfasst: Mo 31.08.09 17:46 
:oops: Ich dachte, da steht ein SET. Na dann geht das natürlich nicht ;) .
JungerIslaender Threadstarter
ontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 427
Erhaltene Danke: 5

Win XP
Delphi 7; Delphi 2005
BeitragVerfasst: Mo 31.08.09 19:13 
Jo funktioniert. DANKE FÜR EURE HILFE WAR ECHT AM VERZWEIFELN!
ausblenden Quelltext
1:
2:
3:
  $aendern = "UPDATE konten Set
  bestellung = '$bestellung' WHERE user = '$username'";
  $update = mysql_query($aendern);
Yogu
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2598
Erhaltene Danke: 156

Ubuntu 13.04, Win 7
C# (VS 2013)
BeitragVerfasst: Sa 05.09.09 22:56 
user profile iconJungerIslaender hat folgendes geschrieben Zum zitierten Posting springen:
ausblenden Quelltext
1:
2:
$time = time();
$time = date("H:i",$timestamp);

:gruebel:
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Sa 05.09.09 23:49 
user profile iconJungerIslaender hat folgendes geschrieben Zum zitierten Posting springen:
Jo funktioniert. DANKE FÜR EURE HILFE WAR ECHT AM VERZWEIFELN!
ausblenden C#-Quelltext
1:
2:
3:
  $aendern = "UPDATE konten Set
  bestellung = '
$bestellung' WHERE user = '$username'";
  $update = mysql_query($aendern);


xkcd.com/327/ ... BITTE unbedingt escapen, sonst hast Du daran nicht lange Freude ;-)

user profile iconYogu hat folgendes geschrieben Zum zitierten Posting springen:
user profile iconJungerIslaender hat folgendes geschrieben Zum zitierten Posting springen:
ausblenden Quelltext
1:
2:
$time = time();
$time = date("H:i",$timestamp);

:gruebel:


Darauf hab ich schon vor längerer Zeit hingewiesen ...

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.