Hello guys,
I have many IP records concerning to my user stored in a MySQL Table,
so I must do a Query like this:
I do not know how many records there are, how can I display 10 records per page?
Idea 1:
- Store the query result in a array
- In case of the second argument used in the command:
/iphistory Martini002 2
then set pos1 = (arg-2 * 10) and pos2 = (arg-2 * 10 + 10)
- Show items from pos1 to pos2 of that array
Idea 2:
- Count the max rows for Martini002:
Store that result and set maxPages = result/10 (Rounding it to the next number)
- In case of the second argument used in the command:
/iphistory Martini002 2
then do this query:
---
The problem here is:
- I am newbie using Skript, I just made one SK and works very nice with MySQL but not sure if the method that I am using is the most efficient for doing queries.
- I do not know how to use arrays, one guy was explaining me about sections, but I did not understood very well how to use them.
- I do not know how to round numbers, sorry but the documentation is not very organizated at least I can not find some things.
- I do not know how to store more than one record from queries, I did not find out yet how to perform this.
- Actually I am doing individual queries...
Sorry if I mix various things in this thread but, I need your help..
---
Look at this example when performing a query:
I hate this example, it must be done with less code.. But I do not know yet how to work with arrays
---
I am using Skellett addon for MySQL.
Hope you can guide me
Thanks
[doublepost=1487544268,1487472796][/doublepost]@LimeGlass can you help me here please?
[doublepost=1487652900][/doublepost]BUMP
I have many IP records concerning to my user stored in a MySQL Table,
so I must do a Query like this:
Code:
SELECT IP FROM ipTables WHERE UserName = 'Martini002'
I do not know how many records there are, how can I display 10 records per page?
Idea 1:
- Store the query result in a array
- In case of the second argument used in the command:
/iphistory Martini002 2
then set pos1 = (arg-2 * 10) and pos2 = (arg-2 * 10 + 10)
- Show items from pos1 to pos2 of that array
Idea 2:
- Count the max rows for Martini002:
Code:
SELECT COUNT('IP') FROM ipTables WHERE UserName = 'Martini002'
- In case of the second argument used in the command:
/iphistory Martini002 2
then do this query:
Code:
SELECT IP FROM ipTables WHERE UserName = 'Martini002' Limit 10 OFFSET '%arg-2*10%'
---
The problem here is:
- I am newbie using Skript, I just made one SK and works very nice with MySQL but not sure if the method that I am using is the most efficient for doing queries.
- I do not know how to use arrays, one guy was explaining me about sections, but I did not understood very well how to use them.
- I do not know how to round numbers, sorry but the documentation is not very organizated at least I can not find some things.
- I do not know how to store more than one record from queries, I did not find out yet how to perform this.
- Actually I am doing individual queries...
Sorry if I mix various things in this thread but, I need your help..
---
Look at this example when performing a query:
Code:
#Query how many refers have this player
set {_result} to mysql result of query "SELECT COUNT(`Referente`) From lncbunonlinetime.referidos WHERE `Referente` = '%arg-2%'"
set {_refPlayer::*} to mysql string "COUNT(`Referente`)" in {_result}
set {totalRef-%arg-2%} to {_refPlayer::1}
#Who was the last refered
set {_result} to mysql result of query "SELECT `Nombre` From lncbunonlinetime.referidos WHERE `Referente` = '%arg-2%' ORDER BY `FechaRegistro` DESC LIMIT 1"
set {_refPlayer::*} to mysql string "Nombre" in {_result}
set {ultRef-%arg-2%} to {_refPlayer::1}
#Date of the latest refer
set {_result} to mysql result of query "SELECT `FechaRegistro` From lncbunonlinetime.referidos WHERE `Referente` = '%arg-2%' ORDER BY `FechaRegistro` DESC LIMIT 1"
set {_refPlayer::*} to mysql string "FechaRegistro" in {_result}
set {ultRefFecha-%arg-2%} to {_refPlayer::1}
set {_refPlayer::*} to "Nadie lo ha referido aun.."
#Who refer him
set {_result} to mysql result of query "SELECT `Referente` FROM `referidos` WHERE `Nombre` = '%arg-2%' "
set {_refPlayer::*} to mysql string "Referente" in {_result}
set {referente-%arg-2%} to {_refPlayer::1}
I hate this example, it must be done with less code.. But I do not know yet how to work with arrays
---
I am using Skellett addon for MySQL.
Hope you can guide me
Thanks
[doublepost=1487544268,1487472796][/doublepost]@LimeGlass can you help me here please?
[doublepost=1487652900][/doublepost]BUMP