SA-MP Forums Archive
[REP ++] MYSQL HELP - 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: [REP ++] MYSQL HELP (/showthread.php?tid=576988)



[REP ++] MYSQL HELP - buburuzu19 - 08.06.2015

Hello guys , i am working on an automatic system for CNN and i am little stuck.
I store all the advertisments in a table called 'Ads' . What do i want to do with the Advertisments ? I want that every ad to be showed in-game one by one with some time between them.But this is not a problem for me , i know how to do that , my real question is how to get them row by row , i mean if in database are 10 Advertisments first to be showed that one from the first row , than the second from the second row .... etc.

When i do the selection query "SELECT * FROM `Ads` WHERE `Adhasbeenshowed` = '0' " are displayed only the Advertisments that was not showed but there are more than 1. How can i show them one by one from the selection query?


Re: [REP ++] MYSQL HELP - Richie© - 08.06.2015

Use timestamp and ORDER BY.


Re: [REP ++] MYSQL HELP - buburuzu19 - 08.06.2015

Quote:
Originally Posted by Richie©
Посмотреть сообщение
Use timestamp and ORDER BY.
I did this already, the selection code from my first comment is just an example, my problem is getting one by one the advertisments because when i use SELECT it shows me all the ads and i don't know how to show the first ad , then the second ..etc from the SELECT.


Re: [REP ++] MYSQL HELP - Sergei - 08.06.2015

LIMIT offset,howmany, like LIMIT 5,1 would get your 6th row.


Re: [REP ++] MYSQL HELP - buburuzu19 - 10.06.2015

Quote:
Originally Posted by Sergei
Посмотреть сообщение
LIMIT offset,howmany, like LIMIT 5,1 would get your 6th row.
Worked !

PlayerInfo[playerid][Sergei] += 1 REP;