Uzupełniłem ręcznie zapytanie i mam problem z bazą.
class DB {
public $db = null;
public function __construct() {
include_once "system/config.php";
$this->db = new mysqli(DB_SERVER, DB_USER, DB_PASS, DBNAME);
if ($this->db->connect_errno) {
echo "Error MySQLi: (". $this->db->connect_errno . ") " . $this->db->connect_error;
}
}
public function connect()
{
$this->db = new mysqli(DB_SERVER, DB_USER, DB_PASS, DBNAME);
return $this->db;
}
public function query($query)
{
//
}
}
class Player
{
public $player;
public function __construct()
{
mb_internal_encoding( 'UTF-8' );
mb_regex_encoding( 'UTF-8' );
mysqli_report( MYSQLI_REPORT_STRICT );
$this->db = new DB();
}
public function getPlayer($array)
{
$this->id = $array['id'];
$user = $this->db->query('SELECT * FROM `user` WHERE `id` = 1');
foreach($user as $key => $value)
{
}
debug($object);
}
public function getGuild()
{
/* */
}
}
Bład:
Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\_class.php on line 59
(
)
Coś skopałem chyba z bazą.