Hello, I was doing some tests, I was trying to make a connection to a MySQL database, but, there were only errors, I tried it as I would normally, but it did not work, in any of the ways. Does anyone have an idea of how to do it? Give me an example, or tell me how to do it.
And we will reply with the normal method. Code doesn't work magically as you copy them. Show the error.
PHP: $this->db = new \mysqli("host", "username", "password", "database name", port); $this->db->query( "CREATE TABLE IF NOT EXISTS PlayerBase( username VARCHAR(20) PRIMARY KEY, rank VARCHAR(20) DEFAULT 'Player'); "); just a example
<?php $servername = "localip"; $username = "username"; $password = "pass"; $conn = new mysqli($servername, $username, $password); if ($conn->connect_error) { die("Connection fail: " . $conn->connect_error); } echo "Connected successfully"; ?>
You are right, there should have been more details. The error that appears is that the "mysqli" class can not be found.