Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static string myConnectionString = "SERVER=localhost;" + "PORT=3307;" + "DATABASE=gt_mp_data;" + "UID=root;" + "PASSWORD=root;";
- public static MySqlConnection connection;
- public static MySqlCommand command;
- public static MySqlDataReader reader;
- public Boolean PlayerExists(string username)
- {
- //Create new connection
- connection = new MySqlConnection(myConnectionString);
- //Create a new command
- command = connection.CreateCommand();
- //Set the command - Create a query
- command.CommandText = "SELECT * FROM user";
- //Open connection
- connection.Open();
- //Tell the reader what to read
- reader = command.ExecuteReader();
- //While the reader is still reading
- while (reader.Read())
- {
- //Select every 'socialClubName' from the table
- //string name = reader.GetString("social_club_name");
- //Check if the player with that name exists
- //API.consoleOutput(name);
- if (username == reader.GetString("Username"))
- {
- //If a user exists with this name then close the connection and return true
- connection.Close();
- return true;
- }
- }
- connection.Close();
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement