Mysql update R7
#1

So i have this code. It should update my car stats
Код:
		UpdateCarFlo(car, "PosX", CarInfo[car][PosX]);
		UpdateCarFlo(car, "PosY", CarInfo[car][PosY]);
......
Код:
public UpdateCarFlo(sCarId, sValue[], Float:sFlo)
{
	new query[140];
	format(query, sizeof(query), "UPDATE scriptcars SET %s = %f WHERE ID = %d", sValue, sFlo, sCarId);
	mysql_function_query(gSQL, query, false, "SendQuery", "");
}
But i got the problem, it only updates the first public. As i can see from mysql_log:
Код:
[17:13:42] >> mysql_query_callback( Connection handle: 1 )
[17:13:42] >> mysql_query_callback( Connection handle: 1 )
[17:13:42] >> mysql_query_callback( Connection handle: 1 )
[17:13:42] Passing query UPDATE scriptcars SET PosX = 664.403991 WHERE ID = 0 | 
[17:13:42] >> mysql_query_callback( Connection handle: 1 )
[17:13:42] >> mysql_query_callback( Connection handle: 1 )
[17:13:42] >> mysql_query_callback( Connection handle: 1 )
[17:13:42] ProcessQueryThread(SendQuery) - Query was successful. (UPDATE scriptcars SET PosX = 664.403991 WHERE ID = 0)
[17:13:42] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
[17:13:42] >> mysql_query_callback( Connection handle: 1 )
[17:13:42] >> mysql_query_callback( Connection handle: 1 )
[17:13:42] >> mysql_query_callback( Connection handle: 1 )
[17:13:42] >> mysql_query_callback( Connection handle: 1 )
[17:13:42] >> mysql_query_callback( Connection handle: 1 )
[17:13:42] >> mysql_query_callback( Connection handle: 1 )
What could be the problem?
Reply
#2

I can't help you on that one, as I don't know bugs fixed since R7. However I'd really, really reconsider that approach. Remember that call to database is one of the most expensive things your script can do. Firing one after another, while you could use single, but nicely written query is not a good idea. And if for any reason you do things like that, at least use a transaction.
Reply
#3

Can someone help me then? How to fix it?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)