SA-MP Forums Archive
Still battling - 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: Still battling (/showthread.php?tid=296499)



Still battling - Shoulen - 11.11.2011

I'm still battling to get the hang of this
I'm using Blue's MySQL Script and trying run this:
Код:
format(query, sizeof(query), "SELECT * FROM `SAMP` WHERE `playername` LIKE '%s' LIMIT 0 , 30", pname);
	new connection = mysql_connect(SQL_HOST,SQL_USER,SQL_DB,SQL_PASS);
	mysql_query(query, connection);
	mysql_store_result(connection);
	printf("%i",mysql_num_rows(connection));
	mysql_free_result(connection);
when I run it, it is giving me:
Quote:

[23:01:32] CMySQLHandler::StoreResult() - No data to store.

In the debug

Does anyone possibly know why or what I'm doing wrong?


Re: Still battling - Calgon - 11.11.2011

Try run the query through phpMyAdmin or another interface to confirm it's valid or returns any results at all.


Re: Still battling - Shoulen - 11.11.2011

Already tried, query runs 100% through CMD.


Re: Still battling - Calgon - 11.11.2011

Connection handle should be the last parameter of mysql_query, right now it's interpretting 'connection' as the resultid.

This should be right:
pawn Код:
mysql_query(query, 0, 0, connection);



Re: Still battling - Shoulen - 11.11.2011

I'm still getting

Quote:

"[23:57:19] CMySQLHandler::StoreResult() - No data to store."

Though from the Query I'm getting
Quote:

[23:57:19] CMySQLHandler::Query(resultID) - Threaded query with id 0 started. (Extra ID: 0)

Which I guess is fine, right?


Re: Still battling - Calgon - 11.11.2011

It just means your query is being executed through a thread, which actually works out better for the server.

Do you connect and close every time you need to? It's better to just keep 1 active connection constantly.


Re: Still battling - Shoulen - 11.11.2011

I've set the connect function to be executed once and the variable that is set to the connect is a global one, still exact same errors.