SA-MP Forums Archive
MySQL related.. - 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 related.. (/showthread.php?tid=655642)



MySQL related.. - div - 26.06.2018

Hello, I need help regarding MySQL..

I want to make logging system to make SMLOGS/PMLOGS..


Like I will make a command /SMLOG, I can make it fetch all the SMs of that person.. But thats not how i want..



I want it to fetch the latest 10 transactions or messages :/


Re: MySQL related.. - SyS - 26.06.2018

https://www.w3schools.com/sql/sql_autoincrement.asp
https://www.w3schools.com/sql/sql_orderby.asp
https://www.w3schools.com/sql/sql_top.asp


Re: MySQL related.. - div - 26.06.2018

No role of MYSQL, other than creating tables..


All the transactions will be saved.. BUT ONLY the latest 10 transactions of the player will be SHOWN


Re: MySQL related.. - zT KiNgKoNg - 26.06.2018

Maybe start by creating a database... That part is self-explanatory, then start adding data that is specific for that person...

So say you have an account table and each person is given a separate ID (via auto-increment), you can use that ID (if you take it and store it for each player that logs in) and put that as one of the Data Values in the database for the SM/PM logs... Then you'll be able to "SELECT * FROM 'TABLE' WHERE User='%d' LIMIT (LIMIT NUMBER)" or as SyS pointed out... Start by learning SQL.

As an example.

ID (Auto-increment) | User (Integer) | (then your other data)


Re: MySQL related.. - div - 26.06.2018

Thanks, the LIMIT was what i wanted dude! +Rep


Re: MySQL related.. - SyS - 26.06.2018

Quote:
Originally Posted by div
Посмотреть сообщение
No role of MYSQL, other than creating tables..


All the transactions will be saved.. BUT ONLY the latest 10 transactions of the player will be SHOWN
The link i posted was not about "creating tables".It's about AUTO_INCREMENT,ORDER BY and LIMIT which is needed for your achieving your goal.The question was too basic therefore i advice you to start learning the language from basics.


Re: MySQL related.. - div - 26.06.2018

The tables can be created from PHPMYADMIN though, and the code is written above it