SA-MP Forums Archive
About cache_get_row. - 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: About cache_get_row. (/showthread.php?tid=451977)



About cache_get_row. - TH3_R3D™ - 19.07.2013

Hello,

I want to know what does it mean that "index" in cache_get_row.

cache_get_row(row, idx, des.);

What is the index?

Thanks in advance.


Re: About cache_get_row. - Misiur - 19.07.2013

It's the offset of field in row.

Quote:

SELECT 'abc', 1, 0x424344, "def" FROM dual

value of:
field with offset 0 - "abc"
field with offset 1 - 1
field with offset 2 - 0x424344 (aka "ABC")
field with offset 3 - "def"

Let's say you have table with fields id, name, nick
Quote:

SELECT * FROM yourtable

field with offset 0 - id
field with offset 1 - name
field with offset 2 - nick

#e: This will return those field values


Re: About cache_get_row. - Firewire - 19.07.2013

The index is another word for name. (It'd be your field number in the database.. The first one begins from 0)

https://sampforum.blast.hk/showthread.php?tid=337810

Read this additional help.


Re: About cache_get_row. - TH3_R3D™ - 19.07.2013

Quote:
Originally Posted by Misiur
Посмотреть сообщение
field with offset 0 - id
field with offset 1 - name
field with offset 2 - nick
They are constants or it depends on my rows?


Re: About cache_get_row. - Firewire - 19.07.2013

Depends on your rows, his was an example


Re: About cache_get_row. - TH3_R3D™ - 19.07.2013

Okay, I'm sorry, but that's the last question, can I jump in the indexes?

example:

Код:
new temp[30];
cache_get_row(0,2, temp);
GivePlayerMoney(playerid, strval(temp));
without returning back to idx:0 and idx:1 .
could it be?

Thanks again


Re: About cache_get_row. - Firewire - 19.07.2013

Only if you're using a query that relates to that table, yes you can


Re: About cache_get_row. - TH3_R3D™ - 19.07.2013

yeah, thanks to you both.


AW: Re: About cache_get_row. - Mellnik - 19.07.2013

Quote:
Originally Posted by TH3_R3D™
Посмотреть сообщение
Okay, I'm sorry, but that's the last question, can I jump in the indexes?

example:

Код:
new temp[30];
cache_get_row(0,2, temp);
GivePlayerMoney(playerid, strval(temp));
without returning back to idx:0 and idx:1 .
could it be?

Thanks again
Use "cache_get_row_int" for fetching an integer.