示例#1
0
function categories_load($ads_db)
{
    $result = userfunc_query($ads_db, 'SELECT * FROM `categories`');
    while ($row = $result->fetch_assoc()) {
        $categories[$row['cat_name']][$row['subcat_id']] = $row['subcat_name'];
    }
    return $categories;
    $result->free();
}
function emails_load($ads_db)
{
    $emails = '';
    $result = userfunc_query($ads_db, 'SELECT id, seller_name, email FROM `ads_authors`');
    while ($row = $result->fetch_assoc()) {
        $emails[$row['id']] = 'Почта:  ' . $row['email'] . '       Имя:   ' . $row['seller_name'];
    }
    return $emails;
}
function city_cat_load($param)
{
    //заполняет массив city, затем вызывает сама себя с другим параметром и заполняет categories
    global $cities, $categories, $ads_db, $result;
    switch ($param) {
        case 'cities_and_categories':
            userfunc_query('SELECT * FROM `cities`');
            while ($row = $result->fetch_assoc()) {
                $cities[$row['city_id']] = $row['city_name'];
            }
            city_cat_load('categories');
            break;
        case 'categories':
            userfunc_query('SELECT * FROM `categories`');
            while ($row = $result->fetch_assoc()) {
                $categories[$row['cat_name']][$row['subcat_id']] = $row['subcat_name'];
            }
            $result->free();
            break;
    }
}