Ciao, premetto che sono agli inizi con la programmazione OO e sto facendo i primi esperimenti...il mio primo è questo:
Codice PHP:
<?php
class db_select
{
function __construct($host, $user, $pass, $db)
{
$this->host = $host;
$this->user = $user;
$this->pass = $pass;
$this->db = $db;
$this->conn = new mysqli($this->host, $this->user, $this->pass, $this->db);
}
function select($sql)
{
$this->sql = $sql;
$this->result = $this->conn->query($this->sql, MYSQLI_USE_RESULT);
//$this->row;
while($this->row = $this->result->fetch_row())
{
print $this->row[0]."
\r\n";
}
$this->result->free();
$this->mysqli->close();
}
}
require_once "conn.php"; //contiene i dati per l'accesso al database
$obj = new db_select(SQL_HOST, SQL_USER, SQL_PASS, SQL_DB);
$obj->select("SELECT * FROM dati utenti");
?>
il risultato è il seguente:
Fatal error: Call to a member function fetch_row() on a non-object in C:\wamp\www\prove\db_class_01\db_select.class.php on line 19
non capisco cosa significa questo errore?