Jump to content

Help with a code.


Birdman203

Recommended Posts

I can not figure what is wrong with this code. When it goes to index.php it shows the news the ammount of news specified by $config[news] which is 5, but when it goes to index.php?page=2 it doesn't show anything. And even the $count is set to 0, but really it's not.

Here is the code:
[code]
<?php
require 'required.inc.php';


$news = $config[news];
$page = $_REQUEST['page'];
$mul2 = bcmul($page, $news);
$mul = bcsub($mul2, $news);
if (isset($page)) {
$result = mysql_db_query("typekill_$config[short]", "select * from cp_ftopics where cat_id = '$congig[news_cat]' order by id desc limit $mul , $news") or die(mysql_error());
} else {
$result = mysql_db_query("typekill_$config[short]", "select * from cp_ftopics where cat_id = '$config[news_cat]' order by id desc limit 0, $news") or die(mysql_error());
}
$count = mysql_num_rows($result);
if ($count > $mul) {
$smarty->assign("nextp", 1);
}
if ($count < $mul) {
$smarty->assign("backp", 1);
}
$i = 0;
while ($row = mysql_fetch_array($result)) {
$result2 = mysql_db_query("typekill_global", "select * from cp_members where alias = '$row[author]'") or die(mysql_error());
$qry = mysql_fetch_array($result2);
$cresult = mysql_db_query("typekill_$config[short]", "select * from cp_fposts where topic_id = '$row[id]'") or die(mysql_error());
$row2 = mysql_fetch_array($cresult);
$comments2 = mysql_num_rows($cresult);
$comments = bcsub($comments2, 1);
$time = date("M d Y, h:i:s a", "$row[date]");
$news = array(
'id' => $row[id],
'title' => $func->outp($row[title]),
'date' => $time,
'message' => $func->outp($row2[message]),
'readmore' => $func->outp($row2[readmore]),
'author' => array(
'id' => $qry[member_id],
'firstname' => $qry[firstname],
'lastname' => $qry[lastname],
'alias' => $qry[alias],
'country' => $qry[country]),
'comments' => $comments
);
$news2[$i++] = $news;
}
$smarty->assign("main_news", $news2);

$smarty->display('index.tpl');


?>
[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.