Autor Beitrag
Fire)Sto(rm
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 17

Win XP
Delphi 7 Pers., PHP (HTML, CSS), bisschen C
BeitragVerfasst: So 30.07.06 14:14 
Hi, ich brauche Hilfe, ich habe seit gestern Google durchsucht und versucht aus tutorials schlau zu werden. Es hat einigermaßen geklappt. Der folgende Programmcode gibt in einer msg meinen Nicknamen wieder. Dieser ist in der ersten Zeile gespeichert! Nur wie kann ich die Daten aus anderen Zeilen auch ausgeben?
Thx
ausblenden 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:
procedure TForm1.FormCreate(Sender: TObject);
  var hostname, username, passwort, datenbank, abfrage: PChar;
      Descriptor: PMYSQL;
      result: PMYSQL_RES;
      ergebnis: Integer;
      CRow: PMYSQL_ROW;
begin
  Descriptor := mysql_init(nil);
  hostname := PChar('localhost');
  username := PChar('root');
  passwort := PChar('');
  datenbank := PChar('browsergame');

  mysql_connect(Descriptor,hostname,username,passwort);
  mysql_select_db(Descriptor,datenbank);

 abfrage := 'SELECT name,pass FROM bg_users';
 ergebnis := mysql_query(Descriptor,abfrage);
 if ergebnis = 0 then begin
   result := mysql_store_result(Descriptor);
   CRow := mysql_fetch_row(result);
   ShowMessage(String(CRow[0]));
 end;
end;
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: So 30.07.06 14:20 
Hast du dir auch das MySQL-Tutorial auf www.luckie-online.de angeschaut?
Fire)Sto(rm Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 17

Win XP
Delphi 7 Pers., PHP (HTML, CSS), bisschen C
BeitragVerfasst: So 30.07.06 14:36 
das hier:
mySQL Datenbanken mit Delphi - Teil 1 Grundlagen.htm

das habe ich mir angeguckt, aber ich werde daraus nich so schlau. Das ist auch der grund, warum ich meine beschränkten php kentnisse benutzt habe und mysql_query genommen habe statt mysql_real_query ( habe das noch nie in php gehört ).
Fire)Sto(rm Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 17

Win XP
Delphi 7 Pers., PHP (HTML, CSS), bisschen C
BeitragVerfasst: Di 01.08.06 01:10 
schade, kann mir keiner helfen?
:(
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Di 01.08.06 05:47 
Wenn du php Kenntinisse hast, dann weißt du ja auch das dir
ausblenden Quelltext
1:
CRow := mysql_fetch_row(result);					

eine Ergebniszeile liefert. wenn du den Befehl nochmal aufrufst bekommst du die nächste usw.

_________________
Markus Kinzler.
Fire)Sto(rm Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 17

Win XP
Delphi 7 Pers., PHP (HTML, CSS), bisschen C
BeitragVerfasst: Di 01.08.06 14:38 
okay habe ich gemacht, nur der gibt mir dann ne exception zurück

ausblenden 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:
procedure TForm1.FormCreate(Sender: TObject);
  var hostname, username, passwort, datenbank, abfrage: PChar;
      Descriptor: PMYSQL;
      result: PMYSQL_RES;
      CRow: Array of PMYSQL_ROW;
      ergebnis, i, count: Integer;
begin
  Descriptor := mysql_init(nil);
  hostname := PChar('localhost');
  username := PChar('root');
  passwort := PChar('');
  datenbank := PChar('browsergame');

  mysql_connect(Descriptor,hostname,username,passwort);
  mysql_select_db(Descriptor,datenbank);

 abfrage := 'SELECT * FROM bg_users';
 ergebnis := mysql_query(Descriptor,abfrage);
 if ergebnis = 0 then begin
   result := mysql_store_result(Descriptor);
   count := mysql_num_rows(result);
   for i := 0 to count do begin
     CRow[i] := mysql_fetch_row(result); // hier kommt die exception und ich versteh nich warum :(
   end;
 end;
end;
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Di 01.08.06 18:37 
Wie wäs es mit
ausblenden Delphi-Quelltext
1:
2:
SetLength( CRow, count);
for i := 0 to count-1 do begin

_________________
Markus Kinzler.
Fire)Sto(rm Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 17

Win XP
Delphi 7 Pers., PHP (HTML, CSS), bisschen C
BeitragVerfasst: Mi 02.08.06 13:59 
cool, thx, es geht :)))