13.10.2012, 15:04
Oh god, listen.
The field indexes are RELATIVE TO THE QUERY. Not the MySQL table structure. This means that if your query looks like this:
SELECT score, kills, deaths FROM players WHERE name = 'ScriptWriter'
Then the fields returned will be
score, kills, deaths
Their indexes will be
0, 1, 2
In a more fashionable form:
However, if your query returns a row with 18 fields, you can EASILY get the fields with indexes 2, 4 and 5, since that's what cache_get_row is for. Please head to the first post and see that its syntax is easy:
cache_get_row(row, idx, dest[], connectionHandle = 1)
The second parameter is INDEX. So act like this:
The field indexes are RELATIVE TO THE QUERY. Not the MySQL table structure. This means that if your query looks like this:
SELECT score, kills, deaths FROM players WHERE name = 'ScriptWriter'
Then the fields returned will be
score, kills, deaths
Their indexes will be
0, 1, 2
In a more fashionable form:
score | kills | deaths |
0 | 1 | 2 |
cache_get_row(row, idx, dest[], connectionHandle = 1)
The second parameter is INDEX. So act like this:
pawn Code:
new temp[12], score, kills, deaths;
cache_get_row(0, 2, temp); score = strval(temp);
cache_get_row(0, 4, temp); kills = strval(temp);
cache_get_row(0, 5, temp); deaths = strval(temp);
printf("The player whose data was just loaded has %d score, %d kills and %d deaths.", score, kills, deaths);