function Wo_GetPromotedPost() {
global $wo, $sqlConnect;
$year = date("Y");
$type_table = T_POSTS;
$logged_user_id = Wo_Secure($wo['user']['user_id']);
$query_one = mysqli_query($sqlConnect, "SELECT `id` FROM {$type_table} WHERE `boosted` = '1' AND `user_id` NOT IN (SELECT `blocked` FROM " . T_BLOCKS . " WHERE `blocker` = '{$logged_user_id}') AND `user_id` NOT IN (SELECT `blocker` FROM " . T_BLOCKS . " WHERE `blocked` = '{$logged_user_id}') ORDER BY RAND() LIMIT 1");
$fetched_data = mysqli_fetch_assoc($query_one);
if (count($fetched_data) > 0) {
$post = Wo_PostData($fetched_data['id']);
if (is_array($post)) {
return $post;
}
} else {
return array();
}
}
$query_result = mysqli_query($sqlConnect, "select ...");
while($row = mysqli_fetch_assoc($query_result)){
//...
}