SA-MP Forums Archive
Dialog and mySQL - 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: Dialog and mySQL (/showthread.php?tid=563390)



Dialog and mySQL - Sn00Py - 15.02.2015

Good after noon, I have a little question concerning the Dialogs and mySQL queries.


I want to display last 5-6 911 calls in one dialog, but I don't understand how to do it.


That's the code when the 911 call is inserted into database:

pawn Код:
new query[1024];
        format(query, sizeof(query), "INSERT INTO `911Calls` (`Caller`, `Number`, `Location`, `Situation`, `Taken`) VALUES ('%s', '%d', '%s', '%s', '0');",turner, PlayerInfo[playerid][pPhoneNumber], PlayerCrimeLocation[playerid], PlayerCrimeReport[playerid]);
        mysql_query(query);



Re: Dialog and mySQL - Misiur - 15.02.2015

Quote:

SELECT * FROM `911Calls` ORDER BY id DESC LIMIT 5

That's pretty much it. Use threaded queries for the love of God


Re: Dialog and mySQL - Sn00Py - 15.02.2015

The problem is how to display the data. Is something similar to data displaying from PHP?


Re: Dialog and mySQL - Misiur - 15.02.2015

Well, not quite, you don't have an automatically created array/ORM. You have to fetch each field individually, then create string, and then display stuff, either via SendClientMessage, textdraws or dialog.


Re: Dialog and mySQL - Sn00Py - 15.02.2015

Hm, I thinked about this some time ago, but I thinked too about a 'shorter' solution. Thank you anyway

REP +