<Html>
<Head>
<Title> connect. php </title>
</Head>
<Body>
/* Use PHP in the PHP manual to connect to the Mysql instance */
<? Php
/* Select database for connection */
$ Link = mysql_connect ("mysql_host", "mysql_user", "mysql_password") or die ("cocould not connect ");
Print "Connected successfully ";
Mysql_select_db ("my_database") or die ("cocould not select database ");
/* Execute SQL query */
$ Query = "SELECT * FROM my_table ";
$ Result = mysql_query ($ query) or die ("query failed ");
/* Print the result in HTML */
Print "<Table> \ n ";
While ($ line = mysql_fetch_array ($ result, mysql_assoc ))
{
Print "\ t <tr> \ n ";
Foreach ($ line as $ col_value)
{
Print "\ t <TD> $ col_value </TD> \ n ";
}
Print "\ t </tr> \ n ";
}
Print "</table> \ n ";
/* Release resources */
Mysql_free_result ($ result );
/* Disconnect */
Mysql_close ($ link );
?>
</Body>