Interaction with a Database

PHP has gobs of useful commands and methods for MySQL. We can string them together to amend, update, and retrieve specific information from database tables. To apply our knowledge of MySQL, the most useful command is the query command:


Any single line of MySQL code can be inserted into this command (leave off the semicolon).

If the statement executes correctly, the statement returns a pointer to the resultant. The resultant is a small table that contains MySQL's response to our query. Unlike the database tables, which are located on another server in an unknown format, the resultant table is a PHP table, immediately accessible in local memory.

The pointer to the resultant should then be stored in a variable, which we can then use as an argument for supplemental functions. We then must use individual access functions to isolate actual data:

 $SQLResult = MySQL_query( select * from Players); 

Once we have executed the line(s) of code, we may wish to dissect the result(s) of our database access(es) or see how many rows our UPDATE command affected. That is why many different commands were invented that have PHP parse the returning data into an easily usable format. $SQLResult is difficult for us to use without applying these parsing tools.

In each of these functions, the first parameter is a pointer to the resultant table.

Flash and XML[c] A Developer[ap]s Guide
Flash and XML[c] A Developer[ap]s Guide
ISBN: 201729202
Year: 2005
Pages: 160 © 2008-2017.
If you may any questions please contact us: