Database Reference
In-Depth Information
Figure 11-39
Continued
Example 2: Using PhP Data Objects (PDO)
Our next example is an exercise in using PHP Data Objects (PDO). Here we are re-creating the
ReadArtist.php page, but using PDO to do it. We call the new Web page ReadArtistPDO.php, and
it is shown in Figure 11-40. The PHP code to create the page is shown in Figure 11-41, and you
should compare this PHP code to the PHP code for ReadArtist.php in Figure 11-31.
PHP PDO will become important as newer versions of PHP are released. The power of PHP
PDO is that the only line of PHP code that needs to be changed when using a different DBMS
product is the one that establishes the connection to the database. In Figure 11-41, this is the line:
$PDOconnection = new PDO("odbc:$DSN", $User, $Password);
 
Search WWH ::




Custom Search