About cache_get_row.
#1

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.
Reply
#2

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
Reply
#3

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.
Reply
#4

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?
Reply
#5

Depends on your rows, his was an example
Reply
#6

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
Reply
#7

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

yeah, thanks to you both.
Reply
#9

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)