Order Number

Started on the old forum in January 2008 · view the original in the archive · old links redirect here

3 replies · 689 views · started 18 years ago · 1 min read

Guest #1

Hi, i have a question, for exemple on a list of things with what code can be writed in front on the things the order number..for example 1.x= 12 points 2.y= 10 points 3.z= 5 points And the three things order by a criteria,ascending, i m intersted for that order number, i have a code but it doesn t work corectly, if i have more pages, on every new page the count start again from 1......

nclemale36 Lead · 537 posts #2

Hi, i have a question, for exemple on a list of things with what code can be writed in front on the things the order number..for example 1.x= 12 points 2.y= 10 points 3.z= 5 points And the three things order by a criteria,ascending, i m intersted for that order number, i have a code but it doesn t work corectly, if i have more pages, on every new page the count start again from 1......

can you be a bit more specific . or upload ya code you got that you want fixed . dont understand what u mean at all .

Guest #3
//////////////////////////////////Top Posters List

else if($action=="posteri")
{
    addonline(getuid_sid($sid),"Top posteri","statistici.php?action=$action&page=$page");
    echo "<card id=\"main\" title=\"Top Posteri\">";
    echo "<p align=\"center\">";

    $tmsg = getpmcount(getuid_sid($sid));
  $umsg = getunreadpm(getuid_sid($sid));
  if($umsg>0)
  {
  echo "Mesaje noi:(<a href=\"inbox.php?action=main&sid=$sid\">$umsg</a>)
";
  }
    echo "[b]Top Posteri[/b]
[size="1"]Multumim pentru implicare!
";
    $weekago = time();
    $weekago -= 7*24*60*60;
    $noi = mysql_fetch_array(mysql_query("SELECT COUNT(DISTINCT uid) FROM ibwf_posts WHERE dtpost>'".$weekago."';"));
    echo "<a href=\"statistici.php?action=saptamanal&sid=$sid&page=1\">Saptamana asta($noi[0])</a>
";
    $noi = mysql_fetch_array(mysql_query("SELECT COUNT(DISTINCT uid)  FROM ibwf_posts;"));
    echo "<a href=\"statistici.php?action=tottimpul&sid=$sid&page=1\">Tot timpul($noi[0])</a>[/size]
";
    echo "</p>";
    //////ALL LISTS SCRIPT <<

    if($page=="" || $page<=0)$page=1;
    $num_items = regmemcount(); //changable
    $items_per_page= 10;
    $num_pages = ceil($num_items/$items_per_page);
    if(($page>$num_pages)&&$page!=1)$page= $num_pages;
    $limit_start = ($page-1)*$items_per_page;

    //changable sql

        $sql = "SELECT id, name, posts FROM ibwf_users ORDER BY posts DESC LIMIT $limit_start, $items_per_page";

    echo "

";
    $items = mysql_query($sql);
   $cou =1;
    echo mysql_error();
    
    if(mysql_num_rows($items)>0)
    {
    while ($item = mysql_fetch_array($items))
    {

      $lnk = "$cou.<a href=\"index.php?action=viewuser&who=$item[0]&sid=$sid\">$item[1]</a> [size="1"]Postari: $item[2][/size]";
      echo "$lnk
";
     $cou++;
    }
    }
    echo "</p>";
    echo "<p align=\"center\">";
    if($page>1)
    {
      $ppage = $page-1;
      echo "[u]<a href=\"statistici.php?action=posteri&page=$ppage&sid=$sid&view=$view\">«</a>[/u]___";
    }
    if($page<$num_pages)
    {
      $npage = $page+1;
      echo "[u]<a href=\"statistici.php?action=posteri&page=$npage&sid=$sid&view=$view\">»</a>[/u]";
    }
    echo "
$page/$num_pages
";
    if($num_pages>2)
    {
      $rets = "Dute la pagina<input name=\"pg\" format=\"*N\" size=\"3\"/>";
        $rets .= "<anchor>[Dute]";
        $rets .= "<go href=\"statistici.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>";
  ////// UNTILL HERE >>
    echo "<p align=\"center\">";
      echo "<a href=\"index.php?action=stats&sid=$sid\">";
echo "statistici site</a>|";
    echo "<a href=\"index.php?action=main&sid=$sid\">";
echo "prim</a>";

  echo "</p>";
    echo "</card>";
}

this is the code........i refer $cou. $cou++; but it doesn t.......work because on the next page the count began from 1..again

Guest #4

Move the line: $cou =1; above the line: //changable sql and it will work just fine.

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close