Jump to content

Recommended Posts

Dear all,

 

I have this php code but i failed to get Next and Prev working in this code. can anybody modified this code

 

 

myscript.php

 

if($action=="viewcat")

{

 

    $cid = $_GET["cid"];

    addonline(getuid_sid($sid),"Viewing Forum Category","forum.php?action=viewcat&cid=$cid");

    $cinfo = mysql_fetch_array(mysql_query("SELECT name from ibwf_fcats WHERE id='".$cid."'"));

 

    //////ALL LISTS SCRIPT

    if($page=="" || $page<=0)$page=1;

    $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_forum"));

    $num_items = $noi[0]; //changable

    $items_per_page= 5;

    $num_pages = ceil($num_items/$items_per_page);

    if(($page>$num_pages)&&$page!=1)$page= $num_pages;

    $limit_start = ($page-1)*$items_per_page;

 

    echo "<card id=\"main\" title=\"$cinfo[0]\">";

  echo popup($sid);

  $forums = mysql_query("SELECT id, name FROM ibwf_forums WHERE cid='".$cid."' AND clubid='0' ORDER BY position, id, name LIMIT $limit_start, $item_per_page");

 

    echo "<p align=\"left\">";

    while($forum = mysql_fetch_array($forums))

    {

   

      $notp = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE fid='".$forum[0]."'"));

      $nops = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts a INNER JOIN ibwf_topics b ON a.tid = b.id WHERE b.fid='".$forum[0]."'"));

      $iml = "<img src=\"../images/1.gif\" alt=\"*\"/>";

      echo "<a href=\"forum.php?action=viewfrm&sid=$sid&fid=$forum[0]\">$iml$forum[1]($notp[0]/$nops[0])</a><br/>";

      $lpt = mysql_fetch_array(mysql_query("SELECT id, name FROM ibwf_topics WHERE fid='".$forum[0]."' ORDER BY lastpost DESC LIMIT 0,1"));

      $nops = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE tid='".$lpt[0]."'"));

      if($nops[0]==0)

      {

        $pinfo = mysql_fetch_array(mysql_query("SELECT authorid FROM ibwf_topics WHERE id='".$lpt[0]."'"));

        $tluid = $pinfo[0];

 

      }else{

        $pinfo = mysql_fetch_array(mysql_query("SELECT  uid  FROM ibwf_posts WHERE tid='".$lpt[0]."' ORDER BY dtpost DESC LIMIT 0, 1"));

 

        $tluid = $pinfo[0];

      }

      $tlnm = htmlspecialchars($lpt[1]);

      $tlnick = getnick_uid($tluid);

      $tpclnk = "<a href=\"forum.php?action=viewtpc&sid=$sid&tid=$lpt[0]&go=last\">$tlnm</a>";

      $vulnk = "<a href=\"setting.php?action=viewuser&sid=$sid&who=$tluid\">$tlnick</a>";

  if ($pinfo[0]>0)

      {

      echo "Last post: $tpclnk<br/>Posted by: $vulnk<br/>";

      }

     

    }

    echo "</p>";

 

    echo "<p align=\"center\">";

    $tmsg = getpmcount(getuid_sid($sid));

  $umsg = getunreadpm(getuid_sid($sid));

  if($umsg>0)

  {

  echo "<br/><a href=\"inbox.php?action=main&sid=$sid\">Inbox($umsg/$tmsg)</a><br/>";

  }

echo "</p>";

 

  echo "<p align=\"center\">";

if($page>1)

    {

      $ppage = $page-1;

      echo "<a href=\"lists.php?action=$action&page=$ppage&sid=$sid&view=$view\">Prev</a> ";

    }

    if($page<$num_pages)

    {

      $npage = $page+1;

      echo "<a href=\"lists.php?action=$action&page=$npage&sid=$sid&view=$view\">Next</a>";

    }

    echo "<br/>$page/$num_pages<br/>";

    if($num_pages>2)

    {

      $rets = "Jump to page<input name=\"pg\" format=\"*N\" size=\"3\"/>";

        $rets .= "<anchor>[GO]";

        $rets .= "<go href=\"lists.php\" method=\"get\">";

        $rets .= "<postfield name=\"action\" value=\"$action\"/>";

        $rets .= "<postfield name=\"sid\" value=\"$sid\"/>";

        $rets .= "<postfield name=\"page\" value=\"$(pg)\"/>";

        $rets .= "</go></anchor>";

        echo $rets;

    }

    echo "</p>";

 

  echo "<p align=\"center\">";

  echo "<br/><a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";

  echo "</p>";

  echo "</card>";

}

 

Link to comment
https://forums.phpfreaks.com/topic/74428-solved-next-and-prev-not-working/
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.