SA-MP Forums Archive
Some errors - 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: Some errors (/showthread.php?tid=610864)



Some errors - Nin9r - 29.06.2016

Код HTML:
[21:13:52] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[21:13:56] [ERROR] mysql_escape_string - destination size is too small (must be at least as big as source)
I use in ONPLAYERLOGIN some fields like:


Код HTML:
cache_get_field_content(0, "playerStatus", result); PlayerInfo[extraid][Status] = strval(result);
to get a value from database.

Is it a problem?


Re: Some errors - Konstantinos - 29.06.2016

The size of "result" is too small to store the data. Why would you even need a temporary string and strval when there is cache_get_field_content_int function that does exactly the same thing (internal)?


Re: Some errors - Nin9r - 04.07.2016

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
The size of "result" is too small to store the data. Why would you even need a temporary string and strval when there is cache_get_field_content_int function that does exactly the same thing (internal)?
What do you wanna say? Give me an example please.


Re: Some errors - Sjn - 04.07.2016

He meant, the cell size of your result array is too small. For example, lets say you created it like; result[20] but the data name contains more than 20 characters.

And, with cache_get_field_content_int, you can directly fetch the integer value without having to use strval. Right now, you are fetching the data as a string and converting them into an integer value.


Re: Some errors - Nin9r - 04.07.2016

Quote:
Originally Posted by Sjn
Посмотреть сообщение
He meant, the cell size of your result array is too small. For example, lets say you created it like; result[20] but the data name contains more than 20 characters.

And, with cache_get_field_content_int, you can directly fetch the integer value without having to use strval. Right now, you are fetching the data as a string and converting them into an integer value.
I asked him for an example. I understood that i have to fetch directly the integer.. i want to see how.


Re: Some errors - Sjn - 04.07.2016

Код:
PlayerInfo[extraid][Status] = cache_get_field_content_int(0, "playerStatus");



Re: Some errors - Nin9r - 14.12.2016

Quote:
Originally Posted by Sjn
Посмотреть сообщение
Код:
PlayerInfo[extraid][Status] = cache_get_field_content_int(0, "playerStatus");
Ok thanks. But for floats or chars how do i have to make it?


Re: Some errors - Nin9r - 08.02.2017

bump?