Variable
#1

Can someone tell me how big variable should be for this
PHP код:
mysql_format(g_SQLquerysizeof(query), "UPDATE `players` SET `money` = %d"ammount); 
And how should I know how big new query[]; should be??
Reply
#2

Insert the query lenght as 90 ( new query[90]; ). mysql_format is not the same as the normal formatting.
Reply
#3

But how to know how big lenght should be?? Why declaring 100 if I need lets say 60..
Reply
#4

If you need 60, then insert it as 60. I just told you an estimate.
Reply
#5

But how to know how much do I need??
Should letters be counted same as in format(string..
??
Reply
#6

Quote:
Originally Posted by Micko123
Посмотреть сообщение
But how to know how much do I need??
Should letters be counted same as in format(string..
??
Of course, it should ; That's why we insert the length in: new query[length];
Reply
#7

Okay thx
Reply
#8

Your query max length will be the string length you've got. = 33

Код:
UPDATE `players` SET `money` = %d
Then, take away "%d" as this will be replaced with a number. = 31

Код:
UPDATE `players` SET `money` =
This number can maximum be 999,999,999 (without the commas, dont write it, imagine it). = 40

Код:
UPDATE `players` SET `money` = 999999999
So in your case I would recommend a string length on 41-45 just to be sure. If this was a bank amount of cash, the max amount a integer can hold is: 2,147,483,647. That makes 1 more.
This is how you calculate the lengths
Reply
#9

Thank you bro Repped both
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)