php
connect_error) { die("Connection failed: " . $conn->connect_error); } $conn->query("SET NAMES 'UTF8'"); return $conn;}?>
php
conn=connectdb(); $result=$this->conn->query("SELECT * FROM 15_spring_new WHERE 1;"); var_dump($this->conn->error); }}$bar = new Bar; ?>
This problem occurs whenever a call is found in a function.
The error output is: "No database Selected"
And when I use outside of the class, the program runs normally.
Where is the error?
Reply content:
php
connect_error) { die("Connection failed: " . $conn->connect_error); } $conn->query("SET NAMES 'UTF8'"); return $conn;}?>
php
conn=connectdb(); $result=$this->conn->query("SELECT * FROM 15_spring_new WHERE 1;"); var_dump($this->conn->error); }}$bar = new Bar; ?>
This problem occurs whenever a call is found in a function.
The error output is: "No database Selected"
And when I use outside of the class, the program runs normally.
Where is the error?