The simple connection
<?
$conn = mysql_connect('localhost');
echo $conn;
?>
Output:
Resource id #28
Other variations
<?
mysql_connect('db.domain.com:33306','rasmus','foobar');
mysql_connect('localhost:/tmp/mysql.sock');
mysql_connect('localhost','rasmus','foobar',
true,MYSQL_CLIENT_SSL|MYSQL_CLIENT_COMPRESS);
Persistent Connections
The simple connection
<?
$conn = mysql_pconnect('localhost');
echo $conn;
?>
Output:
Resource id #31
Caveats
o Watch out for multi-credential connections
o Make sure you match up max_connections and MaxClients
" News powered by"
No comments:
Post a Comment