The following code returns two times the same error, even though I would have expected only one:
$ conn = mysql_connect ('localhost', 'root', '');
$ conn2 = mysql_connect ('localhost', 'root', '');
mysql_select_db ('db1', $ conn);
mysql_select_db ('db2', $ conn2);
$ result = mysql_query ("select 1 from dual", $ conn);
$ result2 = mysql_query ("select 1 from luad", $ conn2);
echo mysql_error ($ conn) "<hr>".
echo mysql_error ($ conn2) "<hr>".
The reason for this is that mysql_connect not working as expected a further connection returns. Since the parameters are equal, a further reference to the previous link is returned. So also changes the second mysql_select_db the selected DB of $conn to 'db2'.
If you change the connection parameters of the second connection to 127.0.0.1, a new connection is returned. In addition to the parameters new_link the mysql_connect() function to be forced.