<?php print "Opening the connection to the database server<br />"; mysql_connect("localhost","root","password"); print "Select a database<br />"; $result = mysql_select_db("phpweb"); if( $result) { print "Database selected successfully"; } else { print "There was problem with the database selection<br />"; } ?>
一旦选择成功,全部查询都是针对这个数据库进行的。