Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 01-03-2001, 01:46 AM
Gul Gul is offline
Junior Member
 
Join Date: Jan 2001
Posts: 1
Default How to run Database application on the internet

Hi all

I have developed a delphi database application containing 3 forms.

1. Form1 displays whole database.
2. Form2 allows to search the stuff from database.
3. Form3 allows to insert records in the database.

This application works fine on my machine.

I want to put it on to the server (intranet), so that different people can access it via internet (explorer) at the same time and can view/insert details.

I can create an installation program to install it on each machine. But I wish it to place it on one place only and access it via the internet explorer.

Can anyone help me how can I run or put it on the server and run it via internet explorer.

thanks

Gul
Reply With Quote
  #2  
Old 01-03-2001, 02:04 AM
PoseFant PoseFant is offline
Senior Member
 
Join Date: Jan 2001
Posts: 1,002
Default RE: How to run Database application on the internet

This is possible using COM objects and ActiveX Server ...

Don't ask how ... I'm not into COM object programming ... )


Regards

/Filip
Reply With Quote
  #3  
Old 06-08-2017, 07:20 AM
Merovingio Merovingio is offline
Member
 
Join Date: Jun 2015
Posts: 30
Default

I use for my app standard architetture PHP-MySQL.
Call PHP page to update.
I use C++ with unit in pascal.
//---------------------------------------------------------------------------
function httpPost(URL : string; Params: TStrings) : string;
var
FHttp: TIdHTTP;
ret: string;
begin
FHttp := TIdHTTP.Create(nil);
try
try
Result := FHttp.Post(URL,Params);
except
Result := 'httpPost Error URL:'+URL;
MessageDlg(Result, mtError, [mbOK], 0) ;
end;
finally
FHttp.Free;
end;
end;

//---------------------------------------------------------------------------
bool CallHttp(String page, TStrings * params) {
params->Text = httpPost(FOptions->edHttp->Text+page,params);
return params->Strings[0] == "OK";
}
//---------------------------------------------------------------------------


void __fastcall TFDif::FormKeyUp(TObject *Sender, WORD &Key, TShiftState Shift)
{
int i;
String res;
TStrings * ss;

if(Key == VK_F9) {
ss = new TStringList;

res = Parse("~",FItems->Lines->Strings[ItemID],1);
ss->Add("id="+res);

res = Parse("~",FItems->Lines->Strings[ItemID],2);
ss->Add("nom="+res);
ss->Add("pro="+Edit2->Text);
ss->Add("ind="+Edit3->Text);
ss->Add("com="+Edit5->Text);
ss->Add("cap="+Edit6->Text);

if(CallHttp("updef.php",ss))
Loadanagrafico(Sender);
if (ss->Strings[1] > "") {
MessageDlg(ss->Strings[1], mtInformation, TMsgDlgButtons() << mbOK, 0);
}
delete ss;
}
}
Reply With Quote
  #4  
Old 06-08-2017, 01:01 PM
Merovingio Merovingio is offline
Member
 
Join Date: Jun 2015
Posts: 30
Default

// updef.php

require("app.include.php");

$id = $_GET['id'];
$ind = $_GET['ind'];

$rec = sql("update pec set Indirizzo='$ind' where id=$id");
$rec = sql("select * from pec where id=$id");

print_r($rec[0]);
?>
Reply With Quote
  #5  
Old 06-08-2017, 01:02 PM
Merovingio Merovingio is offline
Member
 
Join Date: Jun 2015
Posts: 30
Default

ooops!
this is updef.php

require("app.include.php");

$status = "OK";
$field = "";

$id = $_POST['id'];

function setMsg($status,$field) {
if ($status <> "KO") {
echo "OK\nOperazione modifica '".$field."' acquisita\n";
} else {
echo "KO\nOperazione modifica '".$field."' NON acquisita\n";
}
}

function update($sql,$ind)
{
$field = " $ind=";
$status = "OK";
if(!sql("update pec set ".$sql)) $status = "KO";
return $field.$status;
}

$ind = $_POST['cap'];
$field = $field.update("cap='$ind' where id=$id",$ind);

$ind = $_POST['pro'];
$field = $field.update("prov='$ind' where id=$id",$ind);

$ind = $_POST['com'];
$field = $field.update("comune='$ind' where id=$id",$ind);

$ind = $_POST['ind'];
$field = $field.update("indirizzo='$ind' where id=$id",$ind);

$ind = $_POST['ind'];
$field = $field.update("attiva='S' where id=$id",'attiva');

setMsg($status,$field);
?>
Reply With Quote
  #6  
Old 06-09-2017, 01:44 AM
Marsheng Marsheng is offline
Senior Member
 
Join Date: Nov 2008
Posts: 282
Default

I sort of want to hijack this thread a bit which will help clarify a few things.

I'm in the same situation. I have a database running on a Raspberry PI with LAMP for the MYSql. I can access the data with my Delphi code via the web. The Pi is great, runs 24/7 on about 3 watts of power. It is also fast.

I now want to access some of the data via the web without downloading a program. I have looked into HTML and soon discovered that I needed to use PHP as well in order to access the database. HTML can't do it. I then discovered that PHP can't return data to a static page, it has to rewrite the whole HTML page. If you want to dynamically populate a HTML page, then you have to add in javascript and Ajax. (At this point the Delphi IDE looks really great. )

So the question is, how to access database info ?

The reason I say hijack is I don't want code but a discussion on options on how to do this?

I have Delphi 10 and haven't looked at all it can do. Can it do something similar ?

The next question is, how do you want to access the data, Mobile Phone, Android, PC, Max or Linux ? - If the web, all platforms are supported.

At this point I think the Delphi code will be used for the back end and the HTML etc for the front end. I really am not keen on learning 4 or so new languages but I cant see any other way forward.

Any suggestions ?

Thanks Wallace
Reply With Quote
  #7  
Old 06-09-2017, 07:54 AM
Norrit Norrit is offline
Moderator
 
Join Date: Aug 2001
Location: Landgraaf
Posts: 7,222
Default

Well, in design I think there is already an issue.
Backend is more then just a database with which you connect. There should be a complete layer (actually multiple, but there's only 1 communication layer) which lets you interact with the db. This layer can be SOAP, but at the moment I'm more into using REST. That's just a choice.
This whole backend can be written in Delphi, since through Indy it supports building a SOAP/REST layer. I've left Delphi and write in C#, but again, that's a choice.

As for the frontend, there are several ways, but all require learning 1 or more new languages. In short web-development is not as straight-forward as windows application development.

I'm not sure if your question is concerning the backend or the frontend, but this is in short what the structure should be
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 10:44 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2017, vBulletin Solutions, Inc.