Un ami m'a proposé de m'écrire le code qu'il me fallait en Delphi.
Prob -> Je n'arrive pas à le traduire, j'y comprend rien.
Quelqu'un connaîtrait le Delphi... et le PHP ?
Salut à tous de Suisse.
Code : Tout sélectionner
procedure TForm1.FormCreate(Sender: TObject);
begin
With database do
Begin
close;
DatabaseName:='test';
DatabaseFileName:='c:\prov\test.adb';
End;
With Table do
Begin
close;
DatabaseName:='test';
TableName:='table';
open;
indexname:='in_tab';
End;
With Table2 do
Begin
close;
DatabaseName:='test';
TableName:='table';
open;
indexname:='in_tab';
End;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Table.close;
Table2.close;
database.close;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Table.First;
While (not table.Eof) and (table.FieldByName('parent_id').asinteger=0) do
Begin
showmessage(table.FieldByName('node_name').asstring);
recherche_niveau(table.FieldByName('id').asinteger);
table.Next;
End;
end;
procedure TForm1.recherche_niveau(param:integer);
Var
Bmk : TBookMark;
begin
if table2.FindKey([param]) then
Begin
While (not table2.Eof) and (table2.fieldbyname('Parent_id').asinteger=param) Do
Begin
showmessage(table2.FieldByName('node_name').asstring);
Bmk:= table2.GetBookmark;
recherche_niveau(table2.FieldByName('id').asinteger);
table2.Gotobookmark(Bmk);
table2.freebookmark(Bmk);
table2.next;
End;
End;
end;
