{% else-1 %}
Playtox * 1.63
(11 окт 2015, 15:21) (0/0) [0]
Переведите данный код с mysql на mysqli, и помогите убрать говкод.

[code] $num = 5;
$page = $_GET['page'];
$q = mysql_query("SELECT COUNT(id) FROM news"*;
$posts = mysql_result($q, 0);
$total = intval(($posts - 1) / $num) + 1;
$page = intval($page);
if (empty($page) or $page < 0) $page = 1;
if ($page > $total) $page = $total;
$start = $page * $num - $num;

$qi = mysql_query("SELECT * FROM news ORDER BY id DESC LIMIT $start, $num"*;

echo '<div class="b-widget b-widget__videos clearfix">';
while ($post = mysql_fetch_assoc($qi)) {

echo '<a href="news?id=' . $post['id'] . '" rel="nofollow" class="b-widget__videos__item">
<img src="' . $post[image] . '" class="b-widget__videos__item__image" alt="' . $post[nameBlock] . '">
<div class="b-widget__videos__item__title">' . $post[nameBlock] . '</div>
</a>';
}[/code]
  • 1 из 1