Mysql connecting to other database without disconnecting other connection.
#1

Hello,

When players register on my server I want that there name and password also will be registered on my forum.
But my mysql connection is already connected to my website database.
Can I insert a query into another database (In this case the forum database) without disconnecting the connection with my website database?

Greetz Kaleotter.
Reply
#2

Depending on the MySQL plugin you use, you can handle multiple connections. The only problem is that you need to specify a connection handle for every query - so the plugin can determine which database you want the query to execute in.

I presume your queries are currently something along the lines of:

pawn Код:
mysql_query("SELECT * FROM `body`");
You'd have to connect to your two databases, create variables for the MySQL connect handle, like:

pawn Код:
new connectionHandle = mysql_connect(...); new connectionHandle2 = mysql_connect(...);
...and update every single query for the correct connection handle, like:

pawn Код:
mysql_query("SELECT * FROM `body`", connectionHandle);
Reply
#3

Ok nice, So if I first connect my database to the website it will be 1?
And when I connect to the forum it will be 2.
So I also can only use the connecthandle with the forum database because i gues that the default connecthandle in a query is 1?

Using BlueG plugin
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)