SA-MP Forums Archive
saving in one 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: saving in one query. (/showthread.php?tid=467522)



saving in one query. - audriuxxx - 03.10.2013

Hi,

It's possible to update mysql table with one query? because now i have a lot of things i need to update, that's why i use about 5 mysql_query. Because if i wrote all in one line i get input line too long bla bla.. But maybe possible to write it?


Re: saving in one query. - Mattakil - 03.10.2013

Quote:
Originally Posted by audriuxxx
Посмотреть сообщение
Hi,

It's possible to update mysql table with one query? because now i have a lot of things i need to update, that's why i use about 5 mysql_query. Because if i wrote all in one line i get input line too long bla bla.. But maybe possible to write it?
When you go to enter the variables, press return to go to a new line and finish typing there, then you wont get the input line too long


AW: saving in one query. - audriuxxx - 03.10.2013

no no i have write no variables just that what i will save i get input line too long.


Re: saving in one query. - iZN - 03.10.2013

You could use '\' to skip to the next line, preventing that input line too long error.

Example:
pawn Код:
format(string, sizeof string, "\
%s test1"
,\
var\
);
Also Strcat can be used to join strings together.


Re: saving in one query. - xXShadowXx - 03.10.2013

Use format.

pawn Код:
new string[...];
format(string,sizeof(string),"UPDATE `accounts` SET `x` = 'y', SET `x` =");
format(string,sizeof(string),"%s 'z'",string);



Re: saving in one query. - Konstantinos - 03.10.2013

Quote:
Originally Posted by xXShadowXx
Посмотреть сообщение
Use format.

pawn Код:
new string[...];
format(string,sizeof(string),"UPDATE `accounts` SET `x` = 'y', SET `x` =");
format(string,sizeof(string),"%s 'z'",string);
strcat is faster.


Re: saving in one query. - xXShadowXx - 03.10.2013

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
strcat is faster.
Also rather awkward when arguments are needed.