FIT3084: (mySQL) Database Access via the WWW
In the previous lecture:
In this lecture:
References
Sebasta, R.W., "Programming the WWW 2009", 5th edition, Pearson, chapter 13.
Relational Database Examples
Example 1.
For every attribute of each entity there could be a column with true or false in it.
The table design above is not ideal. It is better to have one attribute such as "distinctive features" and enter relevant data (scales, bark, legs, wings or fur) into it. What if an entity has more than one attribute simultaneously?
Example 2.
A more complete example organisms table.
The organisms table needs to be used in conjunction with these:
About SQL - Structured Query Language
About mySQL and PHP
mySQL commands
Here are some SQL commands. The tables listed above will be used to illustrate them.
Other Useful mySQL commands.
Interpretting mySQL Queries.
mysql_query( ) doesn't return the output shown above directly as XHTML.
It usually returns a table that can be interpretted with the help of a PHP function like this...
mySQL Result Row Interpretation
PHP arrays are hashes.
The results (confusingly) of a mySQL query therefore contain double sets of elements, one with a numeric key, and one with a string key.
If this data was stored in $result then:
Example PHP Database Access
Courseware | Lecture notes