MySQL listitem ID? - 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 listitem ID? (
/showthread.php?tid=647878)
MySQL listitem ID? -
alanhutch - 12.01.2018
Hi all.
My gamemode has a table only for vehicles, and by the command /vehicles all vehicles that belong to you are listed.
My question is: How can I know the selected vehicle in the dialog?
The script simply search all vehicles with my account ID and it shows it in the list, but I can't know what vehicle has been selected in the dialog, how can I do this?
Thanks for your help.
Re: MySQL listitem ID? -
denNorske - 12.01.2018
An idea could be to sort the query in some way. Alphabetical, price or table-id's if you have a column index.
Then assign them to arrays in a loop, and show the array in the dialog.
SELECT * FROM my_car_table ORDER BY price DESC
Then on the callback, you can loop through the rows in the result, and add them to the array respectively.
Re: MySQL listitem ID? -
alanhutch - 12.01.2018
Quote:
Originally Posted by denNorske
An idea could be to sort the query in some way. Alphabetical, price or table-id's if you have a column index.
Then assign them to arrays in a loop, and show the array in the dialog.
SELECT * FROM my_car_table ORDER BY price DESC
Then on the callback, you can loop through the rows in the result, and add them to the array respectively.
|
So do I have to use some clever way to do it and a regular function doesn't exist?
Re: MySQL listitem ID? -
denNorske - 12.01.2018
you gotta do that on your own yes
Because there is always differnt types of data to load, so making one function doesn't work. You gotta build it up for the purpose yourself