I can use usual MySQL or MySQLi commands in plugins? Example: PHP: public function onEnable(){$link = mysqli_connect("localhost", "root", "********", "database");$var = mysqli_query($link, "SELECT * FROM `".$this->getConfig()->get("mysqltable")."` WHERE `name`='".$event->getPlayer()->getName()."'");$var = mysqli_fetch_array($var);$this->getLogger()->info($var['name']);}
PHP: public function onEnable(){$link = mysqli_connect("localhost", "root", "********", "database");$var = mysqli_query($link, "SELECT * FROM `".$this->getConfig()->get("mysqltable")."` WHERE `name`='".$event->getPlayer()->getName()."'");$var = mysqli_fetch_array($var);$this->getLogger()->info($var['name']);mysqli_close($link);} ?
Actually, to boost the server's performance, I recommend you: - open connection in onEnable() - every time you fetch data, remember to close the result - close connection in onDisable()
Obviously not. Ive been using the non OOP method of mysqli before. I find it messy if you're working on a bigger scale. learn OOP instead. Like this: $db = new \mysqli(/*mysql_data*/); $db->query(); //if you want to query something. $db->query()->fetch_assoc(); //if u want to fetch query results Btw, heres a little hint(works on few): mysqli_query() => $db->query() if you notice, the "_" in the mysqli_query() function, it acts like "->". its not pretty accurate but helps me with this pattern. The best way is to google for mysqli php OOP examples.