How can I use mysqli drivers in PHP native query?
For example. My code:
Model
class Home_model extends CI_Model{
public function getusers(){
$q = "SELECT * FROM `users`";
return $r = mysqli_query($q);
}
}
Controller:
class Home extends CI_Controller{
public function iterateuser(){
while($row = mysqli_fetch_object($this->Home_model->getusers())) {
echo $row->username;
}
}
My code above has an error, saying:
mysqli_query expects at least 2 parameters
Is there a way in CodeIgniter to pass the link on the mysqli_query()
first parameter as described on the php.net documentation http://php.net/manual/en/mysqli.query.php
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…