Autor Beitrag
OliverN_26
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 252

Win7 64-Bit, WinXP SP3
Delphi 7 Enterprise
BeitragVerfasst: Fr 26.08.11 18:48 
Hallo Delphi Gemeinde

Ich habe ein Programm geschrieben was eMails abruft, den Dateiinhalt prüft und dann entsprechend in eine Online Datenbank sendet. Diese Daten werden dann auf einer Internetseite ausgegeben. Das nur kurz zum Verständnis.
Es funktioniert soweit alles wunderbar, allerdings würde ich die Geschwindigkeit gerne etwas optimieren, da der Datendurchsatz ab und an schon sehr groß ist.
Momentan sammle ich die gewünschten Daten und sende sie mittels IdHTTP1.Post an eine PHP Datei. So weit so gut. Der Punkt ist das ich immer nur 1 Datensatz sende. Das muß doch schneller gehen oder? Kann man nicht "alle" Daten in einem Record sammeln und dann diesen komplett schicken?

Hier mal der Funktionsausschnitt:
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
procedure TForm1.Wartung_upload(Sender: TObject);
var
  sl : TStringList;
  i : Integer;
begin
  Internet_pruefen;
  if Internet = true then begin
    with (Sender as TStringGrid) do begin
      for i := 0 to RowCount - 1 do begin
        sl := TStringlist.Create;
        sl.Add('pruef=CheckUser');
        sl.Add('Merker=1');
        sl.Add('bestand=' + Cells[0,i]);
        sl.Add('mma=');
        sl.Add('anlage=' + Cells[1,i]);
        sl.Add('anlage_stat=' + Cells[2,i]);
        sl.Add('strasse=' + Cells[3,i]);
        sl.Add('hsnr=' + Cells[4,i]);
        sl.Add('hsnr_zus=' + Cells[5,i]);
        sl.Add('up_strasse=' + Cells[6,i]);
        sl.Add('up_hsnr=' + Cells[7,i]);
        sl.Add('up_plz=' + Cells[8,i]);
        sl.Add('up_ort=' + Cells[9,i]);
        sl.Add('service_we=' + Cells[10,i]);
        sl.Add('max_we=' + Cells[11,i]);
        sl.Add('et=' + Cells[12,i]);
        sl.Add('signal=' + Cells[13,i]);
        sl.Add('vt_typ=' + Cells[14,i]);
        sl.Add('obj_nr=' + Cells[15,i]);
        sl.Add('obj_stat=' + Cells[16,i]);
        sl.Add('up_stat=' + Cells[17,i]);
        sl.Add('vt_produkt=' + Cells[18,i]);
        sl.Add('vt_stat=' + Cells[19,i]);
        sl.Add('name=' + Cells[20,i]);
        sl.Add('code=' + Cells[21,i]);
        sl.Add('vt_nr=' + Cells[22,i]);
        sl.Add('vt_datum=' + Cells[23,i]);

        try
          IdHTTP1.Post('http://www.domain.com/insert.php',sl);
        except
          Application.MessageBox('Es ist ein Fehler bei der Übertragung aufgetreten!','Programm',MB_ICONWARNING);
        end;

        sl.Free;
      end;
    end;
  end;
end;


Die entsprechende PHP Datei sieht dann so aus:
ausblenden XML-Daten
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
<?PHP
$logged_in = FALSE;

if($_POST['pruef'] == "CheckUser") { $logged_in = 1; }
if($logged_in == 1) {
  if($_POST['Merker'] == "1") {  
    if(isset($_POST['strasse'])) {
    mysql_query("INSERT INTO sk_wartung (bestand, mma, anlage, anlage_stat, strasse, hsnr, hsnr_zus, up_strasse, up_hsnr, up_plz, up_ort, service_we, max_we, et, signal, vt_typ, obj_nr, obj_stat, up_stat, vt_produkt, vt_stat, name, code, vt_nr, vt_datum) VALUES ('$_POST[bestand]', '$_POST[mma]', '$_POST[anlage]', '$_POST[anlage_stat]', '$_POST[strasse]', '$_POST[hsnr]', '$_POST[hsnr_zus]', '$_POST[up_strasse]', '$_POST[up_hsnr]', '$_POST[up_plz]', '$_POST[up_ort]', '$_POST[service_we]', '$_POST[max_we]', '$_POST[et]', '$_POST[signal]', '$_POST[vt_typ]', '$_POST[obj_nr]', '$_POST[obj_stat]', '$_POST[up_stat]', '$_POST[vt_produkt]', '$_POST[vt_stat]', '$_POST[name]', '$_POST[code]', '$_POST[vt_nr]', '$_POST[vt_datum]')"); }
  
  mysql_close(); } }
?>


Vielen Dank für eure Hilfe

lg
Oliver
OliverN_26 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 252

Win7 64-Bit, WinXP SP3
Delphi 7 Enterprise
BeitragVerfasst: Di 30.08.11 14:46 
Hat keiner ne Idee wie ich mehrere Zeilen an eine PHP Datei und diese dann da auslesen kann :-( ?
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Di 30.08.11 14:50 
Moin!

Irgendwie verstehe ich dein Problem nicht so ganz, du hast doch schon alles nötige im Code drin, pack halt weitere Zeilen in den Post-Request und fertig. Wie du die Felder nennst, ist doch deine Sache. :nixweiss:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Andreas L.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Di 30.08.11 15:08 
Du kannst die Datensätze durchnummerieren, in etwa so:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
        sl.Add('recordcount=2');
        for i := 1 to 2 do
        begin
          sl.Add('pruef' + IntToStr(i) + '=CheckUser');
          sl.Add('Merker' + IntToStr(i) + '=1');
          sl.Add('bestand' + IntToStr(i) + '=' + WertIrgendwoherholen);
          sl.Add('mma' + IntToStr(i) + '=');
          sl.Add('anlage' + IntToStr(i) + '=' + WertIrgendwoherholen);
          // ...
        end;


Ich würde an deiner Stelle die $_POST-Daten in deinem PHP-Script escapen, ansonsten ist es für einen Angreifer ein Kinderspiel Zugriff auf deine Datenbank zu bekommen:
ausblenden C#-Quelltext
1:
2:
3:
  $value = $_POST['hsnr_zus'];
  $value = htmlentities($value);
  $value = mysql_real_escape_string($value);


Zuletzt bearbeitet von Andreas L. am Di 30.08.11 15:20, insgesamt 2-mal bearbeitet
OliverN_26 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 252

Win7 64-Bit, WinXP SP3
Delphi 7 Enterprise
BeitragVerfasst: Di 30.08.11 15:09 
Es läuft ja auch alles wunderbar .. nur ein wenig langsam wenn ich z.B. 1000 Datensätze an die Datenbank senden will.

IdHTTP1.Post('http://www.domain.com/insert.php',sl); ruft er ja so oft auf, wie ich Datensätze habe.
Ist es denn nicht möglich das ich die For-Schleife ablaufen lasse, alle meine Daten sammle, und diese dann komplett sende, so daß IdHTTP1.Post('http://www.domain.com/insert.php',sl); nur 1x ausgeführt wird?
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Di 30.08.11 16:40 
Moin!

user profile iconOliverN_26 hat folgendes geschrieben Zum zitierten Posting springen:
Ist es denn nicht möglich das ich die For-Schleife ablaufen lasse, alle meine Daten sammle, und diese dann komplett sende, so daß IdHTTP1.Post('http://www.domain.com/insert.php',sl); nur 1x ausgeführt wird?
Ähm, du hast die letzten beiden Vorschläge gelesen? :les: Und wenn ja, offensichtlich nicht verstanden, oder? :gruebel: Wo genau hakt´s? :nixweiss:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
OliverN_26 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 252

Win7 64-Bit, WinXP SP3
Delphi 7 Enterprise
BeitragVerfasst: Mi 31.08.11 06:57 
Guten Morgen

1. Was genau bedeutet "escapen"? Kann das natürlich so je Datensatz in das PHP Script einbauen, wenn ihr mir sagt das man das machen sollte, aber ich würd schon gern wissen was das bedeutet :-)

2. die Durchnummerierung in Delphi hab ich soweit verstanden. Mein Problem liegt eher in PHP, da ich da nich so fit drin bin. Wie sprech ich die einzelnen Zeilen des Records in dem PHP-Script an?

lg
Andreas L.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Mi 31.08.11 08:00 
Zu 1. escapen bedeutet Zeichen aus dem String zu entfernen bzw. zu ersetzen die evtl. Schaden anrichten könnten.
Beispiel:
ausblenden Quelltext
1:
2:
3:
4:
<?php
  $text = 'hallo <iframe src="http://www.externeseite.com"></iframe> sdfsdf';
  echo $text;
?>


Angenommen der Text wäre nicht hardcodiert sondern vom User eingetippt und über $_GET oder $_POST in die Variable eingelesen, würde jetzt ein Iframe das zu einer fremden Seite führt in deine Seite eingebettet. Statt eines iframes könnte das auch ein externes JavaScript sein, das Schadcode in deine Seite schleust. Wenn du die Funktion htmlentities benutzt bevor du mit dem Text was machst, werden die HTML-Zeichen wie < und > durch &lt; und &gt; ersetzt. Das Echo würde nun bewirken das der HTML-Code nicht vom Browser verarbeitet sondern als normaler Text auf der Seite ausgegeben wird. Es ist also für den User nicht mehr möglich, unerwünschten Code in deine Seite einzufügen.

Genau so funktioniert auch mysql_real_escape_string, nur das eben nicht HTML-Codes neutalisiert werden, sondern SQL-Befehle. Stell dir vor du hast folgendes Statement:
ausblenden Quelltext
1:
SELECT * FROM tabelle WHERE feld = "' . $_POST['param'] . '"					

Würde der User nun in das Feld param folgendes eingeben:
ausblenden Quelltext
1:
blubb"; DROP TABLE tabelle;					

Würde das Statement nun so aussehen:
ausblenden Quelltext
1:
SELECT * FROM tabelle WHERE feld = "blubb"; DROP TABLE tabelle;"					

Das löscht die komplette Tabelle.

Ich hoffe das war verständlich. Weiterführende Infos: htmlentities, mysql_real_escape_string, tut.php-quake.net/de/

Wenn du noch fragen hast, nur raus damit :wink:

Zu 2. :
Du kannst die Werte im Script mit einer For-Schleife einlesen. in etwa so:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
<?php

  $count = $_POST['recordcount'];
  $count = (int) $count; // Damit wirklich nur eine Zahl ankommt

  for($i = 1; $i < $count; $i++) {
    echo 'Datensatz Nr. ' . $i . ':';
    echo 'Hausnr.: ' . htmlentities($_POST['hsnr_zus' . $i]);
  }

?>

Ich würde an deiner Stelle das oben verlinkte PHP-Tutorial durchlesen. PHP ist nicht schwer.
OliverN_26 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 252

Win7 64-Bit, WinXP SP3
Delphi 7 Enterprise
BeitragVerfasst: Mi 31.08.11 09:25 
Danke für die ausführliche Beschreibung :-)
Ich hab das jetzt "versucht" umzubasteln. Er läuft zwar nicht auf einen Fehler aber in der Datenbank kommt nix mehr an.
Hab ich was falsch gemacht?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
sl := TStringlist.Create;
sl.Add('recordcount=' + IntToStr(RowCount));
for i := 0 to RowCount - 1 do begin
  sl.Add('pruef=CheckUser');
  sl.Add('Merker=1');
  sl.Add('wo_nr' + IntToStr(i) + '=' + Cells[0,i]);
  sl.Add('wo_stat' + IntToStr(i) + '=0');
  sl.Add('upload_date' + IntToStr(i) + '=' + DateToStr(Date()));
  sl.Add('upload_time' + IntToStr(i) + '=' + TimeToStr(Now()));
  sl.Add('wo_done' + IntToStr(i) + '=');
  sl.Add('wo_typ' + IntToStr(i) + '=' + Cells[1,i]);
  sl.Add('wlan' + IntToStr(i) + '=' + Cells[2,i]);
  sl.Add('wo_entry' + IntToStr(i) + '=' + Cells[3,i]);
  sl.Add('wo_termin' + IntToStr(i) + '=' + Cells[4,i]);
end;
if sl.Count > 0 then 
  IdHTTP1.Post('http://www.domain.com/insert.php',sl);

sl.Free


PHP-Script
ausblenden XML-Daten
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
<?PHP
$logged_in = FALSE;

if($_POST['pruef'] == "CheckUser") { $logged_in = 1; }
if($logged_in == 1) {  
  require_once(Database_Connection);
  $count = $_POST['recordcount'];
  $count = (int) $count;
  
  if($_POST['Merker'] == "1") {  
  if(isset($_POST['wo_nr'])) {
    for($i = 1; $i < $count; $i++) {    
      mysql_query("INSERT INTO sk_stoerung (wo_nr, wo_stat, upload_date, upload_time, wo_done, wo_typ, wlan, wo_entry, wo_termin, timeslot, tk, kdnr, vorname, name, plz, ort, strasse, hsnr, hsnr_zus, tel_privat, tel_gesch, tel_sonst, we_anz, hs_comment, fi_node, cline, adr_up, l4_atyp, l4_adate, l4_struktur, scram_id, kd_service, anlnr, wartung, wartung_comment, f2_comment, aktive_kd) VALUES (htmlentities($_POST['wo_nr' . $i]), htmlentities($_POST['wo_stat' . $i]), htmlentities($_POST['upload_date' . $i]), htmlentities($_POST['upload_time' . $i]), htmlentities($_POST['wo_done' . $i]), htmlentities($_POST['wo_typ' . $i]), htmlentities($_POST['wlan' . $i]), htmlentities($_POST['wo_entry' . $i]), htmlentities($_POST['wo_termin' . $i]), htmlentities($_POST['timeslot' . $i]), htmlentities($_POST['tk' . $i]), htmlentities($_POST['kdnr' . $i]), htmlentities($_POST['vorname' . $i]), htmlentities($_POST['name' . $i]), htmlentities($_POST['plz' . $i]), htmlentities($_POST['ort' . $i]), htmlentities($_POST['strasse' . $i]), htmlentities($_POST['hsnr' . $i]), htmlentities($_POST['hsnr_zus' . $i]), htmlentities($_POST['tel_privat' . $i]), htmlentities($_POST['tel_gesch' . $i]), htmlentities($_POST['tel_sonst' . $i]), htmlentities($_POST['we_anz' . $i]), htmlentities($_POST['hs_comment' . $i]), htmlentities($_POST['fi_node' . $i]), htmlentities($_POST['cline' . $i]), htmlentities($_POST['adr_up' . $i]), htmlentities($_POST['l4_atyp' . $i]), htmlentities($_POST['l4_adate' . $i]), htmlentities($_POST['l4_struktur' . $i]), htmlentities($_POST['scram_id' . $i]), htmlentities($_POST['kd_service' . $i]), htmlentities($_POST['anlnr' . $i]), htmlentities($_POST['wartung' . $i]), htmlentities($_POST['wartung_comment' . $i]), htmlentities($_POST['f2_comment' . $i]), htmlentities($_POST['aktive_kd' . $i]))"); } }
  
  mysql_close(); } }
?>



Mal ne Frage so nebenbei .. macht es denn von der Geschwindigkeit her überhaupt einen Unterschied, ob ich das jetzt SO mache oder so wie ich es vorher hatte ?!
Andreas L.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: Mi 31.08.11 09:43 
Die Abfrage
ausblenden Quelltext
1:
  if(isset($_POST['wo_nr'])) {					

wird niemals true ergeben. So sollte es gehen:
ausblenden Quelltext
1:
  if(isset($_POST['wo_nr' . $i])) {					


Außerdem muss die Abfrage innerhalb der For-Schleife sein.

Du hast übrigens vergessen mysql_real_escape_string zu verwenden, die Sicherheitslücke besteht weiterhin.
OliverN_26 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 252

Win7 64-Bit, WinXP SP3
Delphi 7 Enterprise
BeitragVerfasst: Mi 31.08.11 09:57 
Datenbank bleibt trotzdem leer. Kann es sein das ich da nen Fehler in der Schreibweise habe? Daten kommen auf jedenfall an, d.h. der Fehler muss in PHP liegen :-(

ausblenden XML-Daten
1:
2:
3:
4:
5:
6:
if($_POST['Merker'] == "1") {  
  for($i = 0; $i < $count; $i++) {  
    if(isset($_POST['wo_nr' . $i])) {
      mysql_query("INSERT INTO sk_stoerung (wo_nr, wo_stat, upload_date, upload_time, wo_done, wo_typ, wlan, wo_entry, wo_termin, timeslot, tk, kdnr, vorname, name, plz, ort, strasse, hsnr, hsnr_zus, tel_privat, tel_gesch, tel_sonst, we_anz, hs_comment, fi_node, cline, adr_up, l4_atyp, l4_adate, l4_struktur, scram_id, kd_service, anlnr, wartung, wartung_comment, f2_comment, aktive_kd) VALUES (htmlentities($_POST['wo_nr' . $i]), htmlentities($_POST['wo_stat' . $i]), htmlentities($_POST['upload_date' . $i]), htmlentities($_POST['upload_time' . $i]), htmlentities($_POST['wo_done' . $i]), htmlentities($_POST['wo_typ' . $i]), htmlentities($_POST['wlan' . $i]), htmlentities($_POST['wo_entry' . $i]), htmlentities($_POST['wo_termin' . $i]), htmlentities($_POST['timeslot' . $i]), htmlentities($_POST['tk' . $i]), htmlentities($_POST['kdnr' . $i]), htmlentities($_POST['vorname' . $i]), htmlentities($_POST['name' . $i]), htmlentities($_POST['plz' . $i]), htmlentities($_POST['ort' . $i]), htmlentities($_POST['strasse' . $i]), htmlentities($_POST['hsnr' . $i]), htmlentities($_POST['hsnr_zus' . $i]), htmlentities($_POST['tel_privat' . $i]), htmlentities($_POST['tel_gesch' . $i]), htmlentities($_POST['tel_sonst' . $i]), htmlentities($_POST['we_anz' . $i]), htmlentities($_POST['hs_comment' . $i]), htmlentities($_POST['fi_node' . $i]), htmlentities($_POST['cline' . $i]), htmlentities($_POST['adr_up' . $i]), htmlentities($_POST['l4_atyp' . $i]), htmlentities($_POST['l4_adate' . $i]), htmlentities($_POST['l4_struktur' . $i]), htmlentities($_POST['scram_id' . $i]), htmlentities($_POST['kd_service' . $i]), htmlentities($_POST['anlnr' . $i]), htmlentities($_POST['wartung' . $i]), htmlentities($_POST['wartung_comment' . $i]), htmlentities($_POST['f2_comment' . $i]), htmlentities($_POST['aktive_kd' . $i]))"); } }
  
  mysql_close(); }
OliverN_26 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 252

Win7 64-Bit, WinXP SP3
Delphi 7 Enterprise
BeitragVerfasst: Mi 31.08.11 13:36 
Ich hab jetzt alle möglichen Variationen probiert aber es funktioniert einfach nicht.
Der Fehler liegt im zusammenführen der $POST-Variable mit der For-Schleifen-ID.
Wo und wie muß ich das "$i" hinschreiben?

Hilfe :-(


Zuletzt bearbeitet von OliverN_26 am Mi 31.08.11 13:55, insgesamt 1-mal bearbeitet
Oliver Marx
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 80
Erhaltene Danke: 18

Win 7 Prof.
Delphi XE Prof.
BeitragVerfasst: Mi 31.08.11 13:55 
Hi,

bin schon etwas "eingerostet" bei PHP. Aber versuch mal die PHP Befehle aus dem string herauszunehmen.

ausblenden XML-Daten
1:
mysql_query("INSERT INTO sk_stoerung [...] , aktive_kd) VALUES (" . htmlentities($_POST['wo_nr' . $i]) . "," . htmlentities($_POST['wo_stat' . $i]) . "," . [...] . "," . htmlentities($_POST['aktive_kd' . $i]) . ")"); }					


Viele Grüße

Oliver
OliverN_26 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 252

Win7 64-Bit, WinXP SP3
Delphi 7 Enterprise
BeitragVerfasst: Mi 31.08.11 15:01 
also .. zuerst einmal danke denn so geht es .. FAST ..
Ich hab es nur mal Testweise auf ein Feld beschränkt innerhalb der Schleife. Wurde alles super in die Datenbank geladen.
Jetz hab ich das wieder umgebaut auf alle Felder und es passiert wieder nix. Ich hab den Text hoch und runter gelesen aber find einfach keinen Fehler.
Woran kann das liegen ?

So siehts momentan aus:
(P.s.: Die Escape-Geschichte hab ich erst mal raus genommen da es sonst zu übersichtlich wird)
ausblenden XML-Daten
1:
2:
3:
4:
5:
6:
7:
8:
require_once(Datenbank_connect);
$count = $_POST['recordcount'];
$count = (int) $count;
if($_POST['Merker'] == "1") {  
  for($i = 0; $i < $count; $i++) {    
    mysql_query("INSERT INTO sk_stoerung (wo_nr, wo_stat, upload_date, upload_time, wo_done, wo_typ, wlan, wo_entry, wo_termin, timeslot, tk, kdnr, vorname, name, plz, ort, strasse, hsnr, hsnr_zus, tel_privat, tel_gesch, tel_sonst, we_anz, hs_comment, fi_node, cline, adr_up, l4_atyp, l4_adate, l4_struktur, scram_id, kd_service, anlnr, wartung, wartung_comment, f2_comment, aktive_kd) VALUES (" . $_POST['wo_nr' . $i] . "," . $_POST['wo_stat' . $i] . "," . $_POST['upload_date' . $i] . "," . $_POST['upload_time' . $i] . "," .  $_POST['wo_done' . $i] . "," . $_POST['wo_typ' . $i] . "," . $_POST['wlan' . $i] . "," . $_POST['wo_entry' . $i] . "," . $_POST['wo_termin' . $i] . "," . $_POST['timeslot' . $i] . "," . $_POST['tk' . $i] . "," . $_POST['kdnr' . $i] . "," . $_POST['vorname' . $i] . "," . $_POST['name' . $i] . "," . $_POST['plz' . $i] . "," . $_POST['ort' . $i] . "," . $_POST['strasse' . $i] . "," . $_POST['hsnr' . $i] . "," . $_POST['hsnr_zus' . $i] . "," . $_POST['tel_privat' . $i] . "," . $_POST['tel_gesch' . $i] . "," . $_POST['tel_sonst' . $i] . "," . $_POST['we_anz' . $i] . "," . $_POST['hs_comment' . $i] . "," . $_POST['fi_node' . $i] . "," . $_POST['cline' . $i] . "," . $_POST['adr_up' . $i] . "," . $_POST['l4_atyp' . $i] . "," . $_POST['l4_adate' . $i] . "," . $_POST['l4_struktur' . $i] . "," . $_POST['scram_id' . $i] . "," . $_POST['kd_service' . $i] . "," . $_POST['anlnr' . $i] . "," . $_POST['wartung' . $i] . "," . $_POST['wartung_comment' . $i] . "," . $_POST['f2_comment' . $i] . "," . $_POST['aktive_kd' . $i] . ")"); }
  
  mysql_close(); }
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mi 31.08.11 15:19 
Moin!

Was hat denn das mysql_close() in der Schleife zu suchen? :nixweiss:

Du meinst nicht, so ein kleiner PHP-Crashkurs wäre was für dich... ? :?

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
OliverN_26 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 252

Win7 64-Bit, WinXP SP3
Delphi 7 Enterprise
BeitragVerfasst: Mi 31.08.11 15:27 
Is doch gar nich in der Schleife ?!
buster
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 66
Erhaltene Danke: 7

WIN 7
Delphi 2010 Prof
BeitragVerfasst: Mi 31.08.11 15:32 
öhm, Strings(char/varchar/text) sollten in Anführungszeichen stehen in einer SQL-Anweisung (?)
also in etwa so:
ausblenden Quelltext
1:
 $sql_string = "INSERT INTO tabelle ([deine Felder]) VALUES ( ... , '" . $variable_x . "', ...)";					

Bastel dir auch vorher schon den String zusammen, dann kannst du ihn hinterher einfacher escapen und ausführen lassen.
ausblenden Quelltext
1:
mysql_query(mysql_real_escape_string($sqlstring));					


@Narses (das close ist nicht in der Schleife... die schließende Klammer ist nur bissel weit hinten ;) ) ...oops, zu spät ^^
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mi 31.08.11 15:43 
Moin!

user profile iconOliverN_26 hat folgendes geschrieben Zum zitierten Posting springen:
Is doch gar nich in der Schleife ?!
user profile iconbuster hat folgendes geschrieben Zum zitierten Posting springen:
(das close ist nicht in der Schleife... die schließende Klammer ist nur bissel weit hinten ;) )
Oh, tatsächlich :oops: wenn man weit genug nach rechts scrollt, ist da noch eine Klammer... ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
OliverN_26 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 252

Win7 64-Bit, WinXP SP3
Delphi 7 Enterprise
BeitragVerfasst: Mi 31.08.11 15:48 
Hallo buster .. kannst du mir das bitte anhand des folgenden Beispiels explizit zeigen?
Danke

ausblenden XML-Daten
1:
mysql_query("INSERT INTO sk_stoerung (wo_nr, wo_done, wo_typ) VALUES (" . $_POST['wo_nr' . $i] . "," . $_POST['wo_done' . $i] . "," . $_POST['wo_typ' . $i] . ")");					
Oliver Marx
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 80
Erhaltene Danke: 18

Win 7 Prof.
Delphi XE Prof.
BeitragVerfasst: Mi 31.08.11 15:57 
Hi,

ich glaube, er meint folgendes (ich kenn mich leider selbst mit SQL nicht aus):

ausblenden XML-Daten
1:
mysql_query("INSERT INTO sk_stoerung (wo_nr, wo_done, wo_typ) VALUES ('" . $_POST['wo_nr' . $i] . "','" . $_POST['wo_done' . $i] . "','" . $_POST['wo_typ' . $i] . "')");					


Viele Grüße

Oliver