|Frames||Modems||Help||Home Page||Chipsets||Search||No Frames|
|Diary Entries||See also Site Info & Diary.|
|4 October 2001||Beginning now construction of PHP pages to fill the tables; first, Server-Side Includes and Database connection...|
|A great deal of what follows has been inspired or helped by Building a Database-driven Web Site Using PHP on the MySQL website. The Server-Side Includes (SSIs) are at Section 68 & Section 69.
A quick recap on PHP: it is produced by the same people that produce the Apache web-server & is a server-side script interpreter (ASP is a Microsoft equivalent). PHP4 contains support for MySQL within the language. It is possible within a PHP script (PHP page) to do all the things that can be done from the MySQL command line. Thus, SQL commands can be issued to a database & the results can then be parsed (split up into components) & presented on a webpage. Conversely, entries in an HTML form can be sent to a .PHP script and used to fill tables in a database. Sounds easy when you say it like that, doesn't it?
In both the cases above the PHP script needs to connect to the database. This means that the hostname, username, password & database need to be specified - all in plain text. This is fine if everything on the server works OK, as these details never appear on pages sent to the client (usually a browser such as Opera or Microsoft Explorer). If PHP stops working, however, the whole page of script may be delivered up to the browser as-is - not a good idea. The idea of SSIs is to put the confidential info into a separate file & include it into the main script, thus ensuring that the confidential bits are never seen directly.
|In what follows below myHostname etc is replaced in the actual file by the actual name etc (quotes need to be included).