Skip to content

Instantly share code, notes, and snippets.

@Ikke
Created April 25, 2011 13:55
Show Gist options
  • Save Ikke/940540 to your computer and use it in GitHub Desktop.
Save Ikke/940540 to your computer and use it in GitHub Desktop.
<?php
$query = DB::insert('users_roles', array('user_id', 'role_id'))
->values(array($this->id, DB::expr("(".
DB::select('id')
->from('roles')
->where('name', '=', $rolename))
.")"));
echo $query
?>
-->
INSERT INTO `users_roles` (`user_id`, `role_id`) VALUES (3, '(SELECT `id` FROM `roles` WHERE `name` = \'login\')')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment