I dont want to rely on all those ORM/Querybuilder etc. tools in Kohana 3.x. I just want do use plain old SQL to Insert a new row in my table of my MySQL Database.
How can I do that?
I dont want to rely on all those ORM/Querybuilder etc. tools in Kohana 3.x. I just want do use plain old SQL to Insert a new row in my table of my MySQL Database.
How can I do that?
You can use DB::query($type, $sql) method to create Database_Query object:
$sql = "INSERT INTO table(column1, column2) VALUES(:value1, :value2)";
$result = DB::query(Database::INSERT, $sql)->bind(':value1', $val1)->bind(':value2', $val2)->execute();
echo $result[0]; // last_insert_id
echo $result[1]; // total rows inserted