SA-MP Forums Archive
Question about mysql query - 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: Question about mysql query (/showthread.php?tid=318878)



Question about mysql query - Tanush123 - 16.02.2012

Well for each
pawn Код:
format(query,sizeof(query),"UPDATE...
do i need to have mysql_query, so something like this (this is a example)
pawn Код:
format(query,sizeof(query),"UPDATE accounts SET AdminLevel = %d,Vip = %d WHERE Name = '%s'",PlayerAdmin,PlayerVIP,PlayerName);
mysql_query(query);
format(query,sizeof(query),"UPDATE accounts SET Cash = %d WHERE Name = '%s'",PlayerCash,PlayerName);
mysql_query(query);
or i can do this
2.
pawn Код:
format(query,sizeof(query),"UPDATE accounts SET AdminLevel = %d,Vip = %d WHERE Name = '%s'",PlayerAdmin,PlayerVIP,PlayerName);
format(query,sizeof(query),"UPDATE accounts SET Cash = %d WHERE NAME = '%s'",PlayerCash,PlayerName);
mysql_query(query);



Re: Question about mysql query - [LoF]Zak - 16.02.2012

When formatting, you override the past data with the new data .. So you need to mysql_query after every one.


Re: Question about mysql query - Toreno - 16.02.2012

I can't see why wouldn't you do all in one line?
pawn Код:
format(query, sizeof(query), "UPDATE accounts SET AdminLevel = %d, Vip = %d, Cash = %d WHERE Name = '%s'", PlayerAdmin, PlayerVIP, PlayerCash, PlayerName);
mysql_query(query);



Re: Question about mysql query - Tanush123 - 16.02.2012

Quote:
Originally Posted by Toreno
Посмотреть сообщение
I can't see why wouldn't you do all in one line?
pawn Код:
format(query, sizeof(query), "UPDATE accounts SET AdminLevel = %d, Vip = %d, Cash = %d WHERE Name = '%s'", PlayerAdmin, PlayerVIP, PlayerCash, PlayerName);
mysql_query(query);
I said its a example -_-, did you even read the sentences. I was only asking a question


Re: Question about mysql query - Toreno - 16.02.2012

I did, yet it's useless. You can only do the first method.