This is a short tutorial implemented as a series of FAQs to show how you can access data held in a MySQL database on a web server.
The FAQs assume that you have reasonable knowledge of Delphi, PHP and MySQL but are unsure how to implement such a system.
The example code will implement a very simple system. The MySQL database contains a table called 'birthdays' which has two columns. The first column contains names of people and is called 'name'. The second column contains birthdates and is called 'born'. The table will have been created using the following SQL:
Code:
CREATE TABLE birthdays ( name VARCHAR(40) PRIMARY KEY NOT NULL, born DATE )
The Delphi application displays a list of people who have a birthday for a given day and month. It gets the information from the 'birthdays' table held on the server.
There are probably components available that will implement much of the Delphi (and possibly PHP) code to do this. However, it can be instructive to write the code yourself.
This tutorial assumes that the 'birthdays' table is populated with suitable data.
The first task is to design a suitable protocol. A protocol is simply a set of rules that the client side Delphi program and the server side PHP script are going to follow.
The second task is to code and test the server side PHP script.
The third task is to code and test the client side Delphi program.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.