Changes

Using PHP with MySQL

31 bytes added, 14:36, 19 March 2009
Connecting with PHP to a MySQL Server
== Connecting with PHP to a MySQL Server ==
<google>ADSDAQBOX_FLOW</google>
Now that we have set up our MySQL database and entered some data it is time to look at using PHP to connect to the database so that we can start to query the database and add new data. The first step in our PHP script is to connect to our MySQL database server. This is achieved using the PHP ''mysql_connect()'' function. The ''mysql_connect()'' function creates a connection to the database server and returns a database resource handle. The function takes five optional arguments. The first is the address of the server hosting the database. This defaults to ''localhost:3306''. The second argument is the user name to be used to connect to the database. The third argument is the password associated with the user name.