Tu jest kod:
function connect($new_link = false) { // var_dump($this->server);die; $this->link_id = mysqli_connect($this->server, $this->user, $this->pass, $new_link); if (!$this->link_id) {//open failed $this->oops("Could not connect to server: <b>$this->server</b>."); } if (!@mysqli_select_db($this->database, $this->link_id)) {//no database $this->oops("Could not open database: <b>$this->database</b>."); } // Deprecated but will get us rolling with mysql 5.7 for now. $this->query("SET SESSION sql_mode = ''"); // unset the data so it can't be dumped $this->server = 'localhost'; // Tutaj podaje host name $this->user = 'root'; // Tutaj podaje user name $this->pass = ' '; // Tutaj podaje hasło $this->database = ''; //Tutaj podaje db name }
Otrzymuje taki błąd
Warning: mysqli_connect(): (HY000/1049): Unknown database '1' in C:\xampp\htdocs\classes\Database.class.php on line 74
Dane do DB są na 100% poprawne i nie rozumiem skąd bierze się baza o nazwie '1'
Linia 74:
$this->link_id = mysqli_connect($this->server, $this->user, $this->pass, $new_link);
Z góry dziękuje za pomoc.