MySQL Query not displaying all results. - 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: MySQL Query not displaying all results. (
/showthread.php?tid=635735)
MySQL Query not displaying all results. -
Dokins - 12.06.2017
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));
}
}
Re: MySQL Query not displaying all results. -
Vince - 12.06.2017
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.
Re: MySQL Query not displaying all results. -
Dokins - 12.06.2017
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.
Re: MySQL Query not displaying all results. -
Dokins - 13.06.2017
still unresolved
Re: MySQL Query not displaying all results. -
Dokins - 15.06.2017
Bump
Re: MySQL Query not displaying all results. -
JasonRiggs - 15.06.2017
I cannot understand what are you trying to do upthere..