PDA

View Full Version : Error LOAD mysql


maikons
07/01/2015, 10:14 PM
Why is giving these errors that are similar when you press the players and when you press the houses?

When the player Connecta that carries it:

[ERROR] "mysql_query" - invalid connection handle (id: 0)


When I open the gamemode that tries to load the houses:

[20:48:41] [WARNING] CMySQLHandle::Create - connection already exists
[20:48:41] [ERROR] "mysql_query" - invalid connection handle (id: 0)
[20:48:41] [WARNING] cache_get_data - no active cache
[20:48:41] [ERROR] "mysql_query" - invalid connection handle (id: 0)
[20:48:41] [WARNING] cache_get_data - no active cache
[20:48:41] [ERROR] "mysql_query" - invalid connection handle (id: 0)
[20:48:41] [WARNING] cache_get_data - no active cache
[20:48:41] [ERROR] "mysql_query" - invalid connection handle (id: 0)
[20:48:41] [WARNING] cache_get_data - no active cache
[20:48:41] [ERROR] "mysql_query" - invalid connection handle (id: 0)
[20:48:41] [WARNING] cache_get_data - no active cache
[20:48:41] [ERROR] "mysql_query" - invalid connection handle (id: 0)
[20:48:41] [WARNING] cache_get_data - no active cache
[20:48:41] [ERROR] "mysql_query" - invalid connection handle (id: 0)
[20:48:41] [WARNING] cache_get_data - no active cache
[20:48:41] [ERROR] "mysql_query" - invalid connection handle (id: 0)
[20:48:41] [WARNING] cache_get_data - no active cache
[20:48:41] [ERROR] "mysql_query" - invalid connection handle (id: 0)
[20:48:41] [WARNING] cache_get_data - no active cache
[20:48:41] [ERROR] "mysql_query" - invalid connection handle (id: 0)
[20:48:41] [WARNING] cache_get_data - no active cache


Load houses:
http://pastebin.com/TyMnsnPs

Load players:
http://pastebin.com/DNg7Xj2i

Divergent
07/01/2015, 10:20 PM
Are you connecting properly? (mysql_connect). Are you using the connection handle from that connection?

DanishHaq
07/01/2015, 10:25 PM
Do a debug for the MySQL, take a look in there and see where the problems start.

maikons
07/01/2015, 10:34 PM
Its my connection:


[23:22:27] [WARNING] CMySQLHandle::Create - connection already exists



#define SQL_WRITE 0
#define SQL_READ 1

#define SQL_HOST "localhost"
#define SQL_DB "sampdb"

#define SQL_USER_WRITE "root"
#define SQL_USER_READ "root"

#define SQL_USER_WRITE_PASS ""
#define SQL_USER_READ_PASS ""

new g_Write;
new g_Read;



forward SQL_DB_CONNECT(database);
public SQL_DB_CONNECT(database)
{
if(database == SQL_WRITE)
{
g_Write = mysql_connect(SQL_HOST, SQL_USER_WRITE, SQL_DB, SQL_USER_WRITE_PASS);
if(mysql_errno() != 0)
{
printf("FAILED CONNECTION TO DATABASE USING %s --- SERVER SHUTTING DOWN ~~~", SQL_USER_WRITE);
SendRconCommand("exit");
}
else
{
printf(" SUCCESSFULLY CONNECTED TO DATABASE '%s' WITH USER '%s'", SQL_DB, SQL_USER_WRITE);
}
}
else
{
g_Read = mysql_connect(SQL_HOST, SQL_USER_READ, SQL_DB, SQL_USER_READ_PASS);
if(mysql_errno() != 0)
{
printf("FAILED CONNECTION TO DATABASE USING %s --- SERVER SHUTTING DOWN ~~~", SQL_USER_READ);
SendRconCommand("exit");
}
else
{
printf(" SUCCESSFULLY CONNECTED TO DATABASE '%s' WITH USER '%s'", SQL_DB, SQL_USER_READ);
print(" ");
}
}
return 1;
}