MySQL Query loads data incorrectly
#1

Hello!,

So i am trying to retrieve data from my MySQL table and it seems to be retrieving data twice.

pawn Код:
for(new i, k = cache_get_row_count(Connection); i < k; i++)
 {
        Weapon_ID   = cache_get_row_int(i, 0, Connection);
        Ammo        = cache_get_row_int(i, 1, Connection);
        printf("Ammo: %d",Ammo);
}
There is only 1 row of data and the Ammo amount is 100. However upon login it gives 200. It keepts doubling the ammo value. I tried debugging and this was the result.

Код:
Ammo: 100
Ammo: 100
Help would be appreciated!
Reply
#2

I'd like to give this a bump.
Reply
#3

Did you try the below?
pawn Код:
i <= k
Reply
#4

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
Did you try the below?
pawn Код:
i <= k
I did try that, gave the same result.

Debug Log:

Код:
 
[20:30:57] Ammo: 100
[20:30:57] Ammo: 0
[20:30:57] Ammo: 100
[20:30:57] Ammo: 0
EDIT: its also loading the weapon the same way

Код:
Weapon_ID: 24 | Ammo: 100
Weapon_ID: 0 | Ammo: 0
Weapon_ID: 24 | Ammo: 100
Weapon_ID: 0 | Ammo: 0
Reply
#5

How many rows does it return and how many rows do you have?
Reply
#6

I got 1 row. And it seems to be returning 4 rows with
Код:
<=
and 2 rows with
Код:
<
Reply
#7

But what does "cache_get_row_count(Connection)" possess?

Anyway, if you get two, then "for(new i = 1;...".
Reply
#8

cache_get_row_count prints out

Код:
Account Name: Zbits
that is really werid.
Reply
#9

Nice, let's validate the name as a value.
Reply
#10

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
Nice, let's validate the name as a value.
what?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)