mysql_tquery - invalid connection handle
#1

Код:
[21:25:18] [ERROR] mysql_tquery - invalid connection handle (id: 0)
[21:25:18] [ERROR] mysql_tquery - invalid connection handle (id: 0)
[21:25:18] [ERROR] mysql_tquery - invalid connection handle (id: 0)
[21:25:18] [ERROR] mysql_tquery - invalid connection handle (id: 0)
[21:25:18] [ERROR] mysql_tquery - invalid connection handle (id: 0)
[21:25:18] [ERROR] mysql_tquery - invalid connection handle (id: 0)
[21:25:18] [ERROR] mysql_tquery - invalid connection handle (id: 0)
[21:25:18] [ERROR] mysql_tquery - invalid connection handle (id: 0)
[21:25:18] [ERROR] mysql_tquery - invalid connection handle (id: 0)
[21:25:18] [ERROR] mysql_tquery - invalid connection handle (id: 0)
[21:25:18] [ERROR] mysql_tquery - invalid connection handle (id: 0)
[21:25:18] [ERROR] mysql_tquery - invalid connection handle (id: 0)
[21:25:18] [ERROR] mysql_tquery - invalid connection handle (id: 0)
[21:25:18] [ERROR] mysql_tquery - invalid connection handle (id: 0)
[21:25:18] [ERROR] mysql_tquery - invalid connection handle (id: 0)
[21:25:18] [ERROR] mysql_tquery - invalid connection handle (id: 0)
[21:25:18] [ERROR] mysql_tquery - invalid connection handle (id: 0)
[21:25:18] [ERROR] mysql_tquery - invalid connection handle (id: 0)
[21:25:18] [ERROR] mysql_tquery - invalid connection handle (id: 0)
[21:25:18] [ERROR] mysql_tquery - invalid connection handle (id: 0)
[21:25:18] [ERROR] mysql_tquery - invalid connection handle (id: 0)
[21:25:50] [ERROR] mysql_tquery - invalid connection handle (id: 0)
[21:25:50] [ERROR] mysql_tquery - invalid connection handle (id: 0)
[21:25:55] [ERROR] mysql_tquery - invalid connection handle (id: 0)
Basically when I connect, I get this whole error inside of mysql_log. I tried researching, had no luck, don't really know where to start with this error but if anyone could help.

The only difference I notice is that mine has mysql_tquery and everyone else had mysql_query, don't know if that's a difference.
Reply
#2

mysql_query does not thread the queries, mysql_tquery which is better.

Quote:

It's highly recommended to thread all your queries (even INSERT & UPDATE).

Reply
#3

Quote:
Originally Posted by Ralfie
Посмотреть сообщение
mysql_query does not thread the queries, mysql_tquery which is better.
What should I be replacing then to make threaded queries?
Reply
#4

Nothing. Connection handle 0 means that there isn't a connection. Either you simply forgot to open it, or the connection parameters are wrong.
Reply
#5

Quote:
Originally Posted by Vince
Посмотреть сообщение
Nothing. Connection handle 0 means that there isn't a connection. Either you simply forgot to open it, or the connection parameters are wrong.
I've tried looking, but I don't see anything.

Anyone able to help with this? http://pastebin.com/4RcnSSMq

That's basically most of the SQL stuff, is there any errors with any of this?
Reply
#6

Hello!

Try this:
PHP код:
SQL_CheckAccount(playerid)
{
    static 
query[128];
    
mysql_tquery(g_iHandle,"SELECT `Username` FROM `characters` WHERE `Character` = '%s'",ReturnName(playerid));
    
//format(query, sizeof(query), "SELECT `Username` FROM `characters` WHERE `Character` = '%s'", ReturnName(playerid));
     //mysql_function_query(g_iHandle, query, true, "OnQueryFinished", "dd", playerid, THREAD_FIND_USERNAME);
     
return 1;

Mencent
Reply
#7

The above example is wrong, you need to format the query before calling it.
Reply
#8

Quote:
Originally Posted by Ralfie
Посмотреть сообщение
The above example is wrong, you need to format the query before calling it.


The example is wrong because you are missing arguments. https://sampwiki.blast.hk/wiki/MySQL/R33#mysql_tquery
Reply
#9

Quote:
Originally Posted by Mencent
Посмотреть сообщение
Hello!

Try this:
PHP код:
SQL_CheckAccount(playerid)
{
    static 
query[128];
    
mysql_tquery(g_iHandle,"SELECT `Username` FROM `characters` WHERE `Character` = '%s'",ReturnName(playerid));
    
//format(query, sizeof(query), "SELECT `Username` FROM `characters` WHERE `Character` = '%s'", ReturnName(playerid));
     //mysql_function_query(g_iHandle, query, true, "OnQueryFinished", "dd", playerid, THREAD_FIND_USERNAME);
     
return 1;

Mencent
using this still gives me the error
Reply
#10

@BR3TT:
Sorry, that was my mistake.
Try this:
PHP код:
SQL_CheckAccount(playerid)
{
    static 
query[128];
    
format(query,sizeof query,"SELECT `Username` FROM `characters` WHERE `Character`='%s'",ReturnName(playerid));
    
mysql_tquery(g_iHandle,query,"OnQueryFinished","ii",playerid,THREAD_FIND_USERNAME);
    
//format(query, sizeof(query), "SELECT `Username` FROM `characters` WHERE `Character` = '%s'", ReturnName(playerid));
     //mysql_function_query(g_iHandle, query, true, "OnQueryFinished", "dd", playerid, THREAD_FIND_USERNAME);
     
return 1;

Mencent
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)