Hi i cant use INSERT UPDATE function with this class: MySQLiDB.
Im trying write data to mysql and if exists this data then need update. So i use INSERT ... ON DUPLICATE KEY UPDATE...
. My code like this:
$db->rawQuery("INSERT INTO table1 (field1,field2,field3) VALUES (?,?,?) ON DUPLICATE KEY UPDATE field2=VALUES(field2),field3=VALUES(field3)", array("value1",value2,value2));
this code works fine. But when use this code in cycle and give values by another array shows me this error: Call to a member function fetch_field() on a non-object in...
. This is code in cycle:
$db->rawQuery("INSERT INTO table1 (field1,field2,field3) VALUES (?,?,?) ON DUPLICATE KEY UPDATE field2=VALUES(field2),field3=VALUES(field3)", array($value[$i][value1],$value[$i][value2],$value[$i][value3]));
What i can do in this situation?