How does PHP know what the last database connection is when mysql_select_db() or mysql_query() is us
- by agscala
Consider the following code:
<?php
$conn = mysql_connect('localhost', 'username', 'password');
mysql_select_db('database', $conn);
?>
This works as expected, but how does PHP know what database connection to use when calling mysql_select_db() in the following example?
<?php
mysql_connect('localhost', 'username', 'password');
mysql_select_db('database');
?>