SA-MP Forums Archive
Invalid connection handle problem - 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: Invalid connection handle problem (/showthread.php?tid=298204)



Invalid connection handle problem - juraska - 19.11.2011

error
Код:
[22:11:01] >> mysql_query( Connection handle: 0 )

[22:11:01] >> mysql_query() - Invalid connection handle. (You set: 0, Highest connection handle ID is 1).

[22:11:01] >> mysql_query( Connection handle: 0 )

[22:11:01] >> mysql_query() - Invalid connection handle. (You set: 0, Highest connection handle ID is 1).
my code

Код:
new q[128];
	format(q, 200, "INSERT INTO `businessdata` (`id`) VALUES (%d)", id);
	mysq_query(q);



Re: Invalid connection handle problem - MP2 - 19.11.2011

pawn Код:
new q[64];
format(q, sizeof(q), "INSERT INTO `businessdata` (id) VALUES (%d)", id);
mysq_query(q);
Try that.


Re: Invalid connection handle problem - juraska - 19.11.2011

Same thing!
until this error everything is alright


Re: Invalid connection handle problem - MP2 - 19.11.2011

It's mysql_query not mysq_query. I guess you corrected that already though.

I'm not sure.


Re: Invalid connection handle problem - System64 - 19.11.2011

please show your mysql_connect if you have it?


Re: Invalid connection handle problem - juraska - 19.11.2011

there mysql_connection = mysql_connect(mysql_host, mysql_user, mysql_database, mysql_password);


Re: Invalid connection handle problem - Joe Staff - 19.11.2011

Is that located under ongamemodeinit?


Re: Invalid connection handle problem - juraska - 19.11.2011

No, it's not. It's in end of script


Re: Invalid connection handle problem - Joe Staff - 19.11.2011

Needs to be in, or at least called from, OnGamemodeInit


Re: Invalid connection handle problem - juraska - 19.11.2011

Same again. okey, are one strage thing
When I load house with same way everything is fain
When I load business is sh**

business loading
Код:
    new q[64];
    format(q, sizeof(q), "INSERT INTO `businessdata` (id) VALUES (%d)", id);
    mysql_query(q);
Houses loading
Код:
new q[128];
	format(q, 200, "INSERT INTO `housedata` (`id`) VALUES (%d)", id);
	QUERY(q);