September 2001
Intermediate to advanced
768 pages
32h 45m
English
Using MySQL from within PHP is a fairly simple business. The general flow of usage is as follows:
Connect to a database server.
Select the database with which you want to work.
Query tables within the selected database.
Note:
Successful queries don’t return the results of the query directly—instead, they return a result handle. Other functions such as mysql_result() and mysql_fetch_row() use the result handle to retrieve the data.
Retrieve the query results.
Disconnect from the database server. (This step is optional; PHP manages MySQL connections automatically, closing them as needed.)
The following script illustrates this flow:
<pre> <?php // Attempt to connect to the default database server // An ID that refers ...
Read now
Unlock full access