Folgendes Problem:
mysqli bind_result als return einer Funktion...
Fehlermeldung:
Notice: Undefined variable: name in D:\...\index.php on line 42
Wie kann ich das lösen?
Danke im vorraus!
mysqli bind_result als return einer Funktion...
PHP:
class Test {
public function __construct() {
$this->db = new mysqli('localhost', 'root', '', 'test');
}
public function qry() {
$sql = 'SELECT
names
FROM
categories';
$qry = $this->db->prepare($sql);
$qry->execute();
$qry->bind_result($name);
return $qry;
}
}
$test = new Test();
$qry = $test->qry();
while ($qry->fetch()) {
echo '<pre>';
var_dump($name);
echo '</pre>';
}
Fehlermeldung:
Notice: Undefined variable: name in D:\...\index.php on line 42
Wie kann ich das lösen?
Danke im vorraus!
Zuletzt bearbeitet von einem Moderator: