Sunday, September 15, 2013

choosing a Database

Once the connection is successful, then we can choose the database that we want. The
command using mysql_select_db ().
example:
 
<? php
mysql_connect ("localhost", "admin", "1admin") or die (mysql_error ());
echo "Connected to MySQL
/>";
mysql_select_db ("test") or die (mysql_error ());
echo "Connected to Database";
?>
 
The above example illustrates how to connect to MySQL with name
server is localhost, username: admin, and password: 1admin. Furthermore choose
test database.



news sources from : Rosihan Ari Yuana

No comments:

Post a Comment