SA-MP Forums Archive
connession_handle always 1 - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: connession_handle always 1 (/showthread.php?tid=609782)



connession_handle always 1 - holahola - 16.06.2016

Hi guys i use this plugin : https://sampforum.blast.hk/showthread.php?tid=56564

i have this :

global variable
new handle
#define HOST "127.0.0.1"
#define USER "root"
#define DATABASE "example"
#define PASSWORD ""

ongamemodeinit()
{
handle=mysql_connect(HOST, USER, DATABASE, PASSWORD);
printf("handle %d",handle);
}

the handle is always 1,
if i turn on or off the mysql server or change the name of database with one doesn't exist the handle is 1. Why?


Re: connession_handle always 1 - Stinged - 16.06.2016

The handle is the connection ID.
If you have to connections to different databases, there will be 1 and 2.

If you're checking if the connection wasn't established, use mysql_errno.


Re: connession_handle always 1 - holahola - 16.06.2016

Quote:
Originally Posted by Stinged
View Post
The handle is the connection ID.
If you have to connections to different databases, there will be 1 and 2.

If you're checking if the connection wasn't established, use mysql_errno.
Resolved. Thak you.