Skip to content

Instantly share code, notes, and snippets.

@henry0312
Created February 15, 2014 10:47
Show Gist options
  • Save henry0312/9017553 to your computer and use it in GitHub Desktop.
Save henry0312/9017553 to your computer and use it in GitHub Desktop.
Inserting multiple rows on FuelPHP
public function action_index()
{
Model_Test::test(); exit;
}
public static function test()
{
$query = \DB::insert('table_name')
->columns(array('col1', 'col2'));
$query->values(array('0', '1'));
$query->values(array('2', '3'));
$query->values(array('5', '4'));
$query->values(array('6', '7'));
Debug::dump($query->compile());
}
Variable #1:
(String): "INSERT INTO `table_name` (`col1`, `col2`) VALUES ('0', '1'), ('2', '3'), ('5', '4'), ('6', '7')" (95 characters)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment