Actually by your response I was able to figure out what the problem
was and what the solution needs to be, that is I should have used
localhost as the host address for mysql connect command rather than host.
However I have another question:
How do you maintain, or better said identify, 2 or more different MySQL
connections in a single Php program?
That is say I connect to server1 via this command:
I checked this link but cannot see how one specifies the database to
use in a query!
Can you kindly give an example of how one does this?
That is how does one specify which database connection to use in a
MySQL command when multiple database connections have to be open
in a Php program?
But just one follow up question:
when one has multiple MySQL connections in a Php program, does one
only specify the MySQL connection in the mysql_query command or in any others too?
Let’s go back to the mysql_query documentation to find out:
If the link identifier is not specified, the last link opened by mysql_connect() is assumed. If no such link is found, it will try to create one as if mysql_connect() was called with no arguments.
If your using more than one connection you need to specify which one you want to use each time otherwise how does php know which one you intend to use?
That was not my question at all.
My question, in case it was not clear last time, is that do we need to specify which MySQL connection to use only in mysql_query() or are there other
Mysql Php commands in which we need to specify which MySQL connection to use when more than one MySQL connection has been opened.
As per above two posters said, you would need the link_identifier for nearly all functions dealing directly with database such as:
mysql_query
mysql_select_db
mysql_create_db
mysql_close
Ok. thanx.
But FYI as I have been programming with this since few a days ago,
I can give you this lil tip:
in fact you do not need to specify the db connection but in the
mysql_query command since in all mysql commands in between 2 different mysql commands you end up referring to the data set from the last mysql_query command so same DB connection is used. Although, I am sure there will be some exceptions, this seems to be a pretty solid and useful rule.