कृपया मुझे बताएं कि मैंने क्या गलत किया है? और बेस के साथ बेहतर तरीके से कैसे काम करें? कनेक्शन काम करता है, लेकिन मैं आधार से जानकारी नहीं देख सकता। मैं तो बस मिलती है:PHP ओओपी और MySQLi कनेक्शन = घातक त्रुटि: अपरिभाषित विधि पर कॉल करें mysqli :: arrayQuery()
Fatal error: Call to undefined method mysqli::arrayQuery()
मैं नहीं समझ सकता है कि यह कैसे तय करने के लिए, गूगल या तो मदद नहीं की।
<?php
class Proc{
protected $DB;
function __construct(){
$this->DB=new mysqli('localhost', 'user', 'password', 'basename');
$this->DB->query("set names utf8");}
function __destruct(){unset($this->DB);}
function GetAll(){
$sql="SELECT * FROM users";
$result = $this->DB->arrayQuery($sql, SQLITE_ASSOC);
return $result;}
}
$Yo = new Proc();
$users = $Yo->GetAll();
echo "All users: ".count($users);
foreach ($users as $user){
$id = $user["ID"];
$n = $user["Name"];
echo "{$id} - {$n}<br/>";}
?>
थोड़ा फिक्स और सभी सही काम करते हैं! सभी को धन्यवाद!
<?php
class Proc{
protected $DB;
function __construct(){
$this->DB=new PDO("mysql:host=localhost;dbname=basename", user, password);
$this->DB->query("set names utf8");}
function __destruct(){unset($this->DB);}
function GetAll(){
$sql="SELECT * FROM users";
$result = $this->DB->query($sql);
return $result;}
}
$Yo = new Proc();
$users = $Yo->GetAll();
foreach ($users as $user){
$id = $user["ID"];
$n = $user["Name"];
echo "{$id} - {$n}<br/>";}
?>
अपरिभाषित विधि mysqli करने के लिए कॉल :: arrayQuery() - मेरा मतलब है त्रुटि संदेश CEAR है, है न? – panther
क्या आप इस फ़ंक्शन को 'arrayQuery' पोस्ट कर सकते हैं यदि आपके पास –
है http://php.net/manual/en/book.mysqli.php की जांच से पता चलता है कि' arrayQuery' उपलब्ध नहीं है (mysqli क्लास में ऐसी विधि नहीं है)। साथ ही, पीडीओ –