help in select count comment

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    help in select count comment

    $nopl = "SELECT id, title, itemurl, uid, pudt, descarcat, descriere ,des ,comment, fileid FROM come4me_wapchat_categorii_download WHERE cid='".$cid."';


    this is in comment
    PHP Code:
    else if ($action=="comments"){

        
    $fileid $_GET["fileid"];
        
    $uid getuid_sid($sid);
        if(
    $page=="" || $page<=0)$page=1;
        
    $noi mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM iw_comup WHERE fileid='".$fileid."'"));
        
    $num_items $noi[0]; //changable
        
    $items_per_page5;
        
    $num_pages ceil($num_items/$items_per_page);
        if((
    $page>$num_pages)&&$page!=1)$page$num_pages;
        
    $limit_start = ($page-1)*$items_per_page;

        
            
    $sql "SELECT fileid, commenter, comment, time, id FROM iw_comup WHERE fileid='".$fileid."' ORDER BY time DESC LIMIT $limit_start$items_per_page";

    ////boxstart("File Comments");
        
        
    $items mysql_query($sql);
        echo 
    mysql_error();
        if(
    mysql_num_rows($items)>0)
        {
        while (
    $item mysql_fetch_array($items))
        {
            
              if(
    isonline($item[1]))
      {
        
    $iml "<img src=\"http://coding-talk.com/images/onl.gif\" alt=\"+\"/>";
        
      }else{
        
    $iml "<img src=\"http://coding-talk.com/images/ofl.gif\" alt=\"-\"/>";
      }
        
    $snick getnick_uid($item[1]);
          
    $lnk "<a href=\"index.php?action=viewuser&amp;who=$item[1]&amp;sid=$sid\">$snick</a>";
          
    $bs date("d/m/y h:i:s A",$item[3] + addhours());
          echo 
    "$lnk<br/>";
          if(
    ismod($uid))
          {
            
    $delnk "<a href=\"share.php?action=delcmnt&amp;sid=$sid&amp;fileid=$item[4]\">[x]</a>";
          }else{
            
    $delnk "";
          }
          
    $text parsepm($item[2]);
          echo 
    "$text<br/>$bs $delnk<br/>";
        }
        }
        echo 
    "<p align=\"center\">";
        if(
    $page>1)
        {
          
    $ppage $page-1;
          echo 
    "<a href=\"share.php?action=$action&amp;page=$ppage&amp;sid=$sid&amp;fileid=$fileid\">«PREV</a> ";
        }
        if(
    $page<$num_pages)
        {
          
    $npage $page+1;
          echo 
    "<a href=\"share.php?action=$action&amp;page=$npage&amp;sid=$sid&amp;fileid=$fileid\">Next»</a>";
        }
        echo 
    "<br/>Page $page of $num_pages<br/>";
        if(
    $num_pages>2){
            
    $rets "<form action=\"share.php\" method=\"get\">Jump to page<input name=\"pg\" format=\"*N\" size=\"3\"/>";
            
    $rets .= "<input type=\"hidden\" name=\"action\" value=\"$action\"/>";
            
    $rets .= "<input type=\"hidden\" name=\"fileid\" value=\"$fileid\"/>";
            
    $rets .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>";
        
    $rets .= "<input id=\"inputButton\" type=\"submit\" value=\"Go\"/>";
            
    $rets .= "</form>";        
        }
             echo 
    $rets;
         echo 
    "</p>";
      
    ////// UNTILL HERE >>
        
    echo "<p align=\"center\">";
       echo 
    "<a href=\"share.php?action=addcmnt&amp;sid=$sid&amp;fileid=$fileid\">";
    echo 
    "Add your comment</a></p>";
    }
    ////////////////////////////////////Post a comment(downloaders)////////////////////



    $nopl "SELECT id, title, itemurl, uid, pudt, descarcat, descriere ,des ,comment, fileid FROM come4me_wapchat_categorii_download WHERE cid='".$cid."';


    echo "
    comments nopl[0]"; 
    it is not working... wrong, showing comment counts ...pls...help
    Last edited by Anshul; 30.05.09, 00:51. Reason: use tags
    com site: http://vampist.net
    download site: http://wapdloads.net
    fb: http://www.facebook.com/pmplx

    #2
    Originally posted by wapmetal View Post
    $nopl = "SELECT id, title, itemurl, uid, pudt, descarcat, descriere ,des ,comment, fileid FROM come4me_wapchat_categorii_download WHERE cid='".$cid."';


    this is in comment

    else if ($action=="comments"){

    $fileid = $_GET["fileid"];
    $uid = getuid_sid($sid);
    if($page=="" || $page<=0)$page=1;
    $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM iw_comup WHERE fileid='".$fileid."'"));
    $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;


    $sql = "SELECT fileid, commenter, comment, time, id FROM iw_comup WHERE fileid='".$fileid."' ORDER BY time DESC LIMIT $limit_start, $items_per_page";

    ////boxstart("File Comments");

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

    if(isonline($item[1]))
    {
    $iml = "<img src=\"images/onl.gif\" alt=\"+\"/>";

    }else{
    $iml = "<img src=\"images/ofl.gif\" alt=\"-\"/>";
    }
    $snick = getnick_uid($item[1]);
    $lnk = "<a href=\"index.php?action=viewuser&amp;who=$item[1]&amp;sid=$sid\">$snick</a>";
    $bs = date("d/m/y h:i:s A",$item[3] + addhours());
    echo "$lnk<br/>";
    if(ismod($uid))
    {
    $delnk = "<a href=\"share.php?action=delcmnt&amp;sid=$sid&amp;f ileid=$item[4]\">[x]</a>";
    }else{
    $delnk = "";
    }
    $text = parsepm($item[2]);
    echo "$text<br/>$bs $delnk<br/>";
    }
    }
    echo "<p align=\"center\">";
    if($page>1)
    {
    $ppage = $page-1;
    echo "<a href=\"share.php?action=$action&amp;page=$ppage&am p;sid=$sid&amp;fileid=$fileid\">«PREV</a> ";
    }
    if($page<$num_pages)
    {
    $npage = $page+1;
    echo "<a href=\"share.php?action=$action&amp;page=$npage&am p;sid=$sid&amp;fileid=$fileid\">Next»</a>";
    }
    echo "<br/>Page $page of $num_pages<br/>";
    if($num_pages>2){
    $rets = "<form action=\"share.php\" method=\"get\">Jump to page<input name=\"pg\" format=\"*N\" size=\"3\"/>";
    $rets .= "<input type=\"hidden\" name=\"action\" value=\"$action\"/>";
    $rets .= "<input type=\"hidden\" name=\"fileid\" value=\"$fileid\"/>";
    $rets .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>";
    $rets .= "<input id=\"inputButton\" type=\"submit\" value=\"Go\"/>";
    $rets .= "</form>";
    }
    echo $rets;
    echo "</p>";
    ////// UNTILL HERE >>
    echo "<p align=\"center\">";
    echo "<a href=\"share.php?action=addcmnt&amp;sid=$sid&amp;f ileid=$fileid\">";
    echo "Add your comment</a></p>";
    }
    ////////////////////////////////////Post a comment(downloaders)////////////////////



    $nopl = "SELECT id, title, itemurl, uid, pudt, descarcat, descriere ,des ,comment, fileid FROM come4me_wapchat_categorii_download WHERE cid='".$cid."';


    echo "comments nopl[0]";


    it is not working... wrong, showing comment counts ...pls...help
    i dont really understand your question but if you want to know how many comments that particular category has? or the particular file?

    Anyways it should be sumthing like this if thats what you want:

    $numcom = mysql_fetch_array(mysql_query("SELECT COUNT(*) WHERE cid='".$cid."'"));

    echo "Comments: ".$numcom[0];

    Comment


      #3
      Thank you br0ther !
      com site: http://vampist.net
      download site: http://wapdloads.net
      fb: http://www.facebook.com/pmplx

      Comment


        #4
        From cid= i just to change to id sir? Cuz im creating download commentz, and commentz are working but counts in 1 file n0t work, pls help
        com site: http://vampist.net
        download site: http://wapdloads.net
        fb: http://www.facebook.com/pmplx

        Comment

        Working...
        X