Hello guys.
I need some help, I have created this function and it works fine, but now I need to use "prepare" in MySQLi. Can I get some help?
I have tried http://dk.php.net/manual/en/mysqli.prepare.php but I don't really understand how to prepare work with MySQLi.
My db obj is ( $this->db ) in my class.
I need a sample of my own code here, and if I want to insert/delete and update data. :)
Thanks a lot to all.
public function query( $sql , $multi = false )
{
// if query is ok
if ( $q = $this->db->query( $sql ) )
{
if ( $multi == true )
{
// multi fetch make in array/object
while( $d = $q->fetch_object() )
{
$obj[] = $d;
}
}
else
{
// single fetch
$obj = $q->fetch_object();
}
return $obj;
}
// if query fail print error
else
{
echo $this->db->error;
return false;
}
}