SA-MP Forums Archive
Error LOAD mysql - 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: Error LOAD mysql (/showthread.php?tid=555479)



Error LOAD mysql - maikons - 07.01.2015

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:
pawn Код:
[ERROR] "mysql_query" - invalid connection handle (id: 0)
When I open the gamemode that tries to load the houses:
pawn Код:
[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


Re: Error LOAD mysql - Divergent - 07.01.2015

Are you connecting properly? (mysql_connect). Are you using the connection handle from that connection?


Re: Error LOAD mysql - DanishHaq - 07.01.2015

Do a debug for the MySQL, take a look in there and see where the problems start.


Re: Error LOAD mysql - maikons - 07.01.2015

Its my connection:

pawn Код:
[23:22:27] [WARNING] CMySQLHandle::Create - connection already exists
pawn Код:
#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;
pawn Код:
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;
}