Welcome Guest, Not a member yet? Register   Sign In
What is mysqli connection id?
#1

[eluser]chengfeng[/eluser]
Hi! I just test CI using mysqli. I already change dbdriver to mysqli. when i use mysqli_query, error occur.
Message: mysqli_query() expects at least 2 parameters, 1 given
In the my model code is:
Code:
class MGeneral extends Model
{
    function MGeneral()
    {
        parent::Model();
    }
    function getRecord()
    {
        $query="SELECT * FROM mysqlidb WHERE ID=1";
        $result=mysqli_query($query);
        return mysqli_fetch_array($result);        
    }
}
I think the error occur cause of no have mysqli connection ID. Could you tell me how to put the connection ID into mysqli_query method?
Code:
mysqli_query(???????,$query);
#2

[eluser]WanWizard[/eluser]
Any reason for hardcoding MySQL statements, and not using the database library?
#3

[eluser]danmontgomery[/eluser]
http://php.net/manual/en/mysqli.query.php

Quote:link
Procedural style only: A link identifier returned by mysqli_connect() or mysqli_init()




Theme © iAndrew 2016 - Forum software by © MyBB