- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
$RECORDS = array();
$qRecords = ' SELECT `id`, `original_name`, `urn_name` FROM `ac_brands` ORDER BY `original_name` ASC ';
$rqRecords = mysql_query($qRecords, $mysql) or die(mysql_error());
// общее количество объявлений в БД
$totalAmt = 0;
while($RECORD = mysql_fetch_assoc($rqRecords))
{
// получаем количество объявлений в БД для данного бренда
$qAmtAds = ' SELECT `count_ads` FROM `ac_brands` WHERE `id` = "'.intval($RECORD['id']).'"';
$rqAmtAds = mysql_query($qAmtAds, $mysql) or die(mysql_error());
$RECORD['amt_ads'] = mysql_fetch_object($rqAmtAds)->{"count_ads"};
$totalAmt += $RECORD['amt_ads'];
$RECORDS[] = $RECORD;
}