Help with my sql format code - 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: Help with my sql format code (
/showthread.php?tid=652697)
Help with my sql format code -
mokinys98 - 17.04.2018
Hello help me with my command when commands exsicutes the output outcomes buggy
Triger on command
Код:
CMD:sandelys(playerid)
{
new query[500];
format(query, sizeof(query), "SELECT * FROM `Logai1` ORDER BY `ID` DESC limit 400");
mysql_query(query);
mysql_store_result();
new i, strf[200], str[500], eilute[500];
new vardas[500], ivykis[500], idejo[500], date[500];
for(i = 0; i < 400; i++)
{
mysql_fetch_row(eilute);
mysql_fetch_field_row ( query, "Vardas" ) ; vardas[i] = strval ( query ) ; <-- Name
mysql_fetch_field_row ( query, "Ivykis" ) ; ivykis[i] = strval ( query ) ; <-- Custom log
mysql_fetch_field_row ( query, "Idejo" ) ; idejo[i] = strval ( query ) ; <-- IN/OUT
mysql_fetch_field_row ( query, "Date" ) ; date[i] = strval ( query ) ; <-- DATE
if(idejo[i] == 1) <-- IF the log contain true in "idejo"
{
format(str, 300, "{00ff00}%s, %s %s\n",vardas[i],ivykis[i],date[i]); strcat(strf, str);
}
else format(str, 300, "{ff0000}%s, %s %s\n",vardas,ivykis,date); strcat(strf, str);
}
mysql_free_result();
ShowPlayerDialog(playerid, 2525, DIALOG_STYLE_LIST, "Sandelio Logai", strf, "Aiљku", "");
}
MYSQL TABLE
I checked mysqllog.txt and the fetching looks good
mysqllog.txt
https://pastebin.com/SDiC6STn
tried %s and %d format just for check if the value isnt set to int
and for testing i left in else just full array but nothing works
Re: Help with my sql format code -
mokinys98 - 19.04.2018
Bump anyone?
Re: Help with my sql format code -
mokinys98 - 19.04.2018
Код:
CMD:sandelys(playerid)
{
new query[500];
format(query, sizeof(query), "SELECT * FROM `Logai1` ORDER BY `ID` DESC limit 10");
mysql_query(query);
mysql_store_result();
new x, str[120], strf[1100];
while(mysql_retrieve_row())
{
new KoksVardas[24], Koksivykis[50], Aridejo[5], Data[30];
x ++;
mysql_fetch_field_row(KoksVardas, "Vardas");
mysql_fetch_field_row(Koksivykis, "Ivykis");
mysql_fetch_field_row(Aridejo, "Idejo");
mysql_fetch_field_row(Data, "Date");
format(str, 300, "{00ff00}%s, %s %s\n",KoksVardas, Koksivykis, Data); strcat(strf, str);
ShowPlayerDialog(playerid, 2525, DIALOG_STYLE_LIST, "Sandelio Logai", strf, "Aiљku", "");
}
mysql_free_result();
return 1;
}
This command worked for me. Had headace for 2 nights :/