FPWeb Example
lazarus / 38-Networking and Web Programming
----------------------------------------------------------------------
rretamar · 2019-02-20 10:19
I nedd a example of REAL use form FpWeb components.
A small app (standalone, using the included http server) with a single
html query form for retrieve data form a single table (ex. sqlite).
Any idea ?
----------------------------------------------------------------------
taqtaq · 2019-02-22 15:06
Hi check this perhaps can help you
https://forum.lazarus.freepascal.org/index.php/topic,29055.45.html
This is a tutorial
https://bitbucket.org/leledumbo/books/downloads/
----------------------------------------------------------------------
Leledumbo · 2019-02-22 17:09
Enough?
Code: Pascal [Select][+][-]window.onload = function(){var x1 =
document.getElementById("main_content_section"); if (x1) { var x =
document.getElementsByClassName("geshi");for (var i = 0; i {$mode
objfpc} uses classes, fphttpapp, httpdefs, httproute, db, sqldb,
sqlite3conn; procedure GimmeSomethingFromDB(ARequest: TRequest;
AResponse: TResponse);var Conn: TSQLConnector; Query:
TSQLQuery;begin Conn := TSQLConnector.Create(nil); with Conn do
begin ConnectorType := 'SQLite3'; DatabaseName :=
'data.sqlite'; Transaction := TSQLTransaction.Create(Conn); end;
Query := TSQLQuery.Create(nil); Query.DataBase := Conn; with
AResponse.Contents do begin Clear; Add('');
Add(''); Add('
'); Add('
Example'); Add(' '); Add(' ');
Add(' ');
Add(' '); Add(' | Name | '); Add('
Value | '); Add('
'); { make the table:
CREATE TABLE mytable ( name VARCHAR(16), value
INTEGER ); } Query.SQL.Text := 'select * from mytable';
Query.Open; while not Query.EOF do begin Add(' ');
Add(' | '+Query.FieldByName('name').AsString+' | ');
Add(' '+Query.FieldByName('value').AsString+' | ');
Add('
'); Query.Next; end; Add('
');
Add(' '); Add(''); end; Query.Close;
Query.Free; Conn.Free;end; begin
HTTPRouter.RegisterRoute('/gimme',@GimmeSomethingFromDB);
Application.Port := 9000; Application.Initialize;
Application.Run;end.
----------------------------------------------------------------------
rretamar · 2019-02-26 05:11
Thanks !!!!. I test this code and work fine. Display all table
records in a html table.
I try to add a previous html query form, for enter a string and
number, and query database with both.
Sorry...only know lazarus for develop databases desktop apps.
----------------------------------------------------------------------
TheEditor · 2023-10-26 05:30
That tutorial no longer exists there. Is there an updated URL?
Quote from: taqtaq on February 22, 2019, 04:06:24 pmHi check this
perhaps can help you
https://forum.lazarus.freepascal.org/index.php/topic,29055.45.html
This is a tutorial
https://bitbucket.org/leledumbo/books/downloads/
----------------------------------------------------------------------
BlueIcaro · 2023-10-26 05:33
Quote from: TheEditor on October 26, 2023, 07:30:08 amThat tutorial no
longer exists there. Is there an updated URL?
Quote from: taqtaq on February 22, 2019, 04:06:24 pmHi check this
perhaps can help you
https://forum.lazarus.freepascal.org/index.php/topic,29055.45.html
This is a tutorial
https://bitbucket.org/leledumbo/books/downloads/
Hello, you have to be logged to jump to that url
/BlueIcaro
----------------------------------------------------------------------
Leledumbo · 2023-10-26 07:37
Quote from: TheEditor on October 26, 2023, 07:30:08 amThat tutorial no
longer exists there. Is there an updated URL?
It's now on my github, I no longer use bitbucket.