SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
-
Jul 27, 2005, 06:05 #1
- Join Date
- Oct 2000
- Posts
- 407
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Work with database on another server?
Hi,
I am redoing the website for a catering company and they work with an internal program to handle orders etc. As it is now, people can order from their website and the order is then sent via email to a staff member which then manually enters the order in the manually system.
They would like it to be more automatic so when a customer places an order it is automatically added to their internal program.
My question is, can this be done if the website and the database of the internal program is not on the same server? I.E. the website is at some hosting company.
The website will be developed in PHP, but I am not sure which database the internal program uses, but PHP can work together with any type of DB with the right module, correct?
The internal program is written in Delphi which I know nothing about, but I figure I don't need to as it is only the database I need to work with.
Basically, can this be done and it is easy or complicated?
Thanks.
-
Jul 27, 2005, 06:14 #2
- Join Date
- Jul 2005
- Posts
- 2
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hello,
It can be accomplished pretty easily, if you know how to work with the structure of the database.
Depending on the database server you will need to have the right module installed. You can then from PHP connect to a remote database server instead of connecting to localhost. For example, in MySQL you can use this function to connect:
$connection = mysql_connect("IP_of_the_remote_server_here:port_of_the_remote_server_here", "username_here", "password_here");
mysql_select_db("database_name_here");
Or in PostgreSQL use:
$connection = pg_connect("user=username_here password=password_here host=IP_of_the_remote_server_here post=port_of_the_remote_server_here dbname=database_name_here");
Note that you do need to make sure that the server connecting to the database server has the right permissions and that the database server listens to a port :).
The connection to the database shouldn't be that complicated, but understanding the structure of a database someone else designed could be the most difficult part.
Good luck! :)
-
Jul 27, 2005, 07:33 #3
- Join Date
- Apr 2005
- Location
- Moscow, Russia
- Posts
- 557
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by Dalixam
-
Jul 27, 2005, 10:53 #4
- Join Date
- Oct 2000
- Posts
- 407
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Thank you both for your quick replies.
This is much easier and simpler than I expected it to be. I am used to working on localhost, so I wasn't sure if you could use a database on another server. I will be in contact with the guy who originally made the Delphi program and the database, so he should be able to explain his design structure to me.
Now I just need to find out what DBMS they use and I'm good to go
Thanks again for your help.
Bookmarks