We created a dataBase. Now we want to connect to it and show the results in a browser.
We use PHP for this. The examples show some possibilities of PHP.
http://www.nuggetkidd.byethost11.com/minorCourse/exampleInclude.php
We use a file to connect tot the dataBase, the connectionHeader.
We include this file in all the other files, so that when we have to change for example the password, we have to do this only once. And at the same time, the code in PHP is shorter, so it stays more clean.
http://www.nuggetkidd.byethost11.com/minorCourse/includeHeader.php
(if all is well, using "view source" in the browser will not reveal the password, because the PHP code is transformed into HTML. The nonsense you see at the end of the file is what we eventuallu need for a connection from FLASH to this database. With FLASH we can do nice animations and interactions.)
We connect to the database and ask for records, we get the records back and want to show the text and possible images in a nice list. For this we use a while loop.
http://www.nuggetkidd.byethost11.com/minorCourse/loadToFlash3.php
Then we will show also the images using PHP calling the images in a folder with the names of the images form the database. The fact that you have to insert "-things into a string which already needs "-things makes life a bit complicated.
You have to use \"-things before the "-things.....and this looks terrible!!!!!!
http://www.nuggetkidd.byethost11.com/minorCourse/loadToFlash4.php
Here are the PHP - files we used:
(of course the password in the connectionHeader.PHP has to be replaced by your own credentials.)
http://www.nuggetkidd.byethost11.com/minorCourse/php-database.zip
how to display an image in HTML, for example: http://www.fund-online.com/alabook/htmldemo/img2.htm
some PHP documentation, for example:http://php.net/manual/de/function.include.php

Aucun commentaire:
Enregistrer un commentaire