SparkMyte Posted August 24, 2021 Posted August 24, 2021 I am currently creating a roleplay server, and I have managed to create 3 factions through MySQL (on phpmyadmin). I am just wondering how I'd allow players to join these factions, and how to fetch these factions into a list, through a command such as /factions. Thanks for taking the time to read and possibly help!
sparx Posted August 24, 2021 Posted August 24, 2021 Without writing source code for you, the process is fairly simple if you just want to list these factions and print them to the user. Create an SQL query to fetch these faction names from your table. (SELECT <columnName> FROM <tableName>...etc) Execute it via whatever MySQL bridge you are using. This will usually return a ResultSet of some form, which you can loop through and stack onto your instantiated list. Loop the list, printing out in whatever format you want to the user. Feel free how to google how to loop through rows for whatever SQL bridge you are using, e.g. mysql2 for node, MySqlConnector for nuget.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now