MySQL Query not displaying all results.
#1

I feel that the IN operator is causing havoc. Essentially, I'm checking to see if 3 ID's (3 sample slots) exist but it only returns 1 result and I am having great difficulty, any assistance would be appreciated.

BSub is definitely getting submitted.

pawn Code:
new query[256];
format(query, sizeof(query), "SELECT * FROM `arecords` WHERE PSQLID IN(%d, %d, %d)", BSub[playerid][0], BSub[playerid][1], BSub[playerid][2]);
mysql_tquery(dbHandle, query, "GetBloodResult", "i",playerid);
pawn Code:
for(new x = 0; x < 3; x++)
    {
        if(BSub[playerid][x] == cache_get_row_int(x, 1) )
        {
            BSampRes[playerid][x] = 1;
            printf("Sub 0 called");
            printf("RESULT FROM THE ROW %d", cache_get_row_int(x, 1));
        }
    }
Reply
#2

Do you actually test these queries in a separate client? Also you can't be sure that exactly three rows will be returned every time because ids that do not exists are simply not included in the result.
Reply
#3

That's true, but that shouldn't be an issue if there aren't three rows?

It oddly tries to continue, for example.

What query should I do if there are only for instance 2 results or should I check before executing the query?
The thing is, I have another query which expects 4 variables but there are only 3 and it works correctly, it's used to retrieve skins from another account.
This basically calls BSampRes[playerid][x] twice, before stopping. I'm not sure why.

Reply
#4

still unresolved
Reply
#5

Bump
Reply
#6

I cannot understand what are you trying to do upthere..
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)