1, 'name' => 'Directivos - Local '.$building.' - Aula '.$room.' - Turno '.$turn, 'nbr_courses' => 1, 'nbr_users' => 30, 'nbr_classes' => 0, 'session_admin_id' => 1, 'visibility' => SESSION_INVISIBLE, 'session_category_id' => 0, 'promotion_id' => 0, 'display_start_date' => '2013-09-01 00:00:00', 'display_end_date' => '2013-09-30 00:00:00', 'access_start_date' => '2013-09-01 00:00:00', 'access_end_date' => '2013-09-30 00:00:00', 'coach_access_start_date' => '2013-09-01 00:00:00', 'coach_access_end_date' => '2013-09-30 00:00:00' ); $session_id = SessionManager::add($params); if ($session_id === false) { die('Error inserting session with params '.print_r($params,1)); } echo "New session: $session_id\n"; $session++; } $sqlsc .= "($session_id, 1, 30),"; $sqlsu .= "($session_id,$user_id),"; $sqlscu .= "($session_id, 1, $user_id, 4),"; } //flush the last pending bits $ressc = Database::query(substr($sqlsc,0,-1)); $ressu = Database::query(substr($sqlsu,0,-1)); $resscu = Database::query(substr($sqlscu,0,-1)); echo "Inserted $user users in $session sessions, approximately $user_offset per session\n"; $tf = time() - $t0; echo "Process took $tf for $user users\n";