Example #1
0
function timeconditions_timegroups_add_group_timestrings($description, $timestrings)
{
    global $db;
    $sql = "insert timegroups_groups(description) VALUES ('{$description}')";
    $db->query($sql);
    $timegroup = mysql_insert_id();
    timeconditions_timegroups_edit_timestrings($timegroup, $timestrings);
    needreload();
    return $timegroup;
}
function timeconditions_timegroups_add_group_timestrings($description, $timestrings)
{
    global $db;
    global $amp_conf;
    $description = $db->escapeSimple($description);
    $sql = "insert timegroups_groups(description) VALUES ('{$description}')";
    $db->query($sql);
    if (method_exists($db, 'insert_id')) {
        $timegroup = $db->insert_id();
    } else {
        $timegroup = $amp_conf["AMPDBENGINE"] == "sqlite3" ? sqlite_last_insert_rowid($db->connection) : mysql_insert_id($db->connection);
    }
    timeconditions_timegroups_edit_timestrings($timegroup, $timestrings);
    needreload();
    return $timegroup;
}