Advertisement
Guest User

MySQL connection using PocketMine plugin

a guest
Aug 28th, 2014
545
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.84 KB | None | 0 0
  1. //////////////////////////////////////////////////
  2. /* How to Connect your Plugin to MySQL Database */
  3. /* This method is not OOP but works :P          */
  4. //////////////////////////////////////////////////
  5. // Just Modify things you want to do. It all -  //
  6. // depends in what your going to do.            //
  7. //////////////////////////////////////////////////
  8.  
  9. $config = $this->plugin->getConfig()->get("MySQLi Details");
  10.  
  11. $mysql_hostname = $config["host"];
  12. $mysql_user = $config["user"];
  13. $mysql_password = $config["password"];
  14. $mysql_database = $config["database"];
  15.  
  16. $bd = mysqli_connect($mysql_hostname, $mysql_user, $mysql_password);
  17. mysqli_select_db($bd, $mysql_database);
  18.  
  19. $name = trim(strtolower($player->getName());
  20.  
  21. $sql = "UPDATE table_name SET value = 'data to update' WHERE name='".$name."'";
  22. $result = mysqli_query($bd, $sql);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement