can anyone help here it is ))) Tell me how to calculate the number of expired ads?
<a href="http://test.com/user/items?itemType=all">Все (<?php $conn = getConnection();
$user_total_items = $conn->osc_dbFetchResult("SELECT COUNT(*) as count FROM %st_item WHERE fk_i_user_id = '%d'", DB_TABLE_PREFIX, osc_logged_user_id());
echo $user_total_items ['count'] ?>)</a>
<a href="http://test.com/user/items?itemType=active">Активные (<?php $conn1 = getConnection();
$result1 = $conn1->osc_dbFetchResult("SELECT COUNT(*) as count FROM %st_item i WHERE i.fk_i_user_id = '%d'
AND i.b_active = 1", DB_TABLE_PREFIX, osc_logged_user_id());
echo $result1['count'];?>) </a>
<a href="http://test.com/user/items?itemType=blocked">Блокированные (<?php $conn2 = getConnection();
$result2 = $conn2->osc_dbFetchResult("SELECT COUNT(*) as count FROM %st_item i WHERE i.fk_i_user_id = '%d'
AND i.b_enabled = 0", DB_TABLE_PREFIX, osc_logged_user_id());
echo $result2['count'];?>)</a>
<a href="http://test.com/user/items?itemType=premium">VIP (<?php $conn3 = getConnection();
$result3 = $conn3->osc_dbFetchResult("SELECT COUNT(*) as count FROM %st_item i WHERE i.fk_i_user_id = '%d'
AND i.b_premium = 1", DB_TABLE_PREFIX, osc_logged_user_id());
echo $result3['count'];?>)</a>
<a href="http://test.com/user/items?itemType=pending_validate">Неактивные (<?php $conn4 = getConnection();
$result4 = $conn4->osc_dbFetchResult("SELECT COUNT(*) as count FROM %st_item i WHERE i.fk_i_user_id = '%d'
AND i.b_active = 0", DB_TABLE_PREFIX, osc_logged_user_id());
echo $result4['count'];?>)</a>
<a href="http://test.com/user/items?itemType=expired">expired (?????????????);
echo $result5['count'];?>)</a>