tags: apache   archive   business   charity   climbing   comic   communication   database   email   exchange   family   fm2008   hack   hardware   humour   linux   liverpool   microsoft   money   mysql   network   oes   opensource   outlook   php   pictures   process   project   quote   real_life   review   rss   science   security   software   thought   tsm   updates   webdev   website   windows  

Basics of PHP - Part 4

Wed, 29 Aug 2007 06:01:58

Yesterday we looked at defining our variables in preparation for the database connection. Today we make the connection.

<?php
mysql_select_db($database, $mysqlconnection);
?>

The code broken down
<?php - Tell the server to expect and process php code
mysql_select_db($database, $mysqlconnection); - Use the 'mysql_select_db' function built within php to select a database. Within the () we pass the database name '$database' from a predefined variable and the connect details '$mysqlconnection' which was also defined in yesterdays code. We end with a ';' to tell the server we've finished with that particular part of code
?> - Close php tag, tell the server we're done with PHP

Tomorrow we're look at calling a row from the database and a full example of all the code working together

Cheers
Ryan Partington