日期:2014-05-17 浏览次数:20745 次
class Application_Model_AdminGroupMapper { // TODO impreve inserts here (more portable between another db engines) static function assignMembersToGroup( Application_Model_AdminGroup &$group, array &$member_ids) { $inserts = array(); foreach($member_ids as $id) { $inserts[] = '('.$group->id.','.mysql_real_escape_string($id).')'; } $db = Zend_Registry::get('db'); $res = $db->query( 'INSERT IGNORE INTO admin_group_has_member(admin_group_id, member_id) VALUES '. implode(',', $inserts)); return $res->rowCount(); }
class Application_Model_AdminGroupMapper { // TODO impreve inserts here (more portable between another db engines) static function assignMembersToGroup( Application_Model_AdminGroup &$group, array &$member_ids) { $inserts = array(); foreach($member_ids as $id) { $inserts[] = '('.$group->id.','.mysql_real_escape_string($id).')'; } $db = Zend_Registry::get('db'); $res = $db->query( 'INSERT IGNORE INTO admin_group_has_member(admin_group_id, member_id) VALUES '. implode(',', $inserts)); return $res->rowCount(); }