(1 май 2016, 04:12) (
1/
0)
[
1]
1.
$q = $db -> query('select count(id) as ia from ia')->fetch_assoc();
Echo $q['ia'];
2.
$q = $db -> query('select count(id) from ia')->fetch_row();
Echo $q['0'];
Добавлено 01.05.16 в 04:17:28:
А лучше
Class db extend mysqli{
public function __construct($h,$s,$n,$p){
parent::__construct($h,$s,$n,$p);
}
public function result($q)
{
return $this->query($q)->fetch_row()[0];
}
}
$db = new db('localhos',....);
$q = $db -> result('select count(id) from ia');
echo $q;