Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jan 2007
    Posts
    13
    Thanks
    1
    Thanked 0 Times in 0 Posts

    comments on profiles

    hi guys, i am new here.
    i recently got a script a friend, its like a myspace & youtube clone kind of thing, the problem with it is that when i go to a members profile and view comments members left, its shows the oldest to news, i want it to show newst to oldest?? plzz help

    heres the comments.php code:
    PHP Code:
    <?php

    include("../connect.php");

    include(
    "../header.php");

    if(
    $PageNo=="")

            
    $PageNo=1;

        else

               
    $PageNo $PageNo;

    if(
    $user_id != '')

    {

        
    $member_flag "MEMBER_PROFILE";

        
    $USERID $user_id;

    }

    else

    {

        
    $member_flag "LOGIN_MEMBER_PROFILE";

        
    $USERID $UsErId;

    }

    $PRODUCTSPERPAGE 10;

    $StartRow $PRODUCTSPERPAGE * ($PageNo-1);

    $user select_user_from_video($user_id);

    $query_comments "select * from comments where comment_type = 'USER' and comment_id = '$user[id]' and status = 'ACTIVE' order by id";

    $result_comments mysql_query($query_comments);



    $totalrows=mysql_affected_rows();

    $totalpages = (int) ($totalrows $PRODUCTSPERPAGE);



    if((
    $totalrows $PRODUCTSPERPAGE)!=0)

          
    $totalpages++;

    $query_comments.= " LIMIT $StartRow,$PRODUCTSPERPAGE";

    $result_comments=mysql_query($query_comments,$db);

    $num_comments mysql_affected_rows();



    ?>

    <div align="center">

      <table width="100%" border="0" cellspacing="0" cellpadding="0">

        <tr>

          <td valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">

            <tr>

              <td width="6"><img src="<?php echo $SITEURL ?>images/1x1.gif" width="1" height="1"></td>

              <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">

                <tr>

                  <td align="left" valign="top"><?php include("../top.php")?></td>

                </tr>

                <tr>

                  <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">

                    <tr>

                      <td height="13" align="left" valign="top" background="<?php echo $SITEURL ?>images/bgblue_curve_top.jpg">

                      <img src="<?php echo $SITEURL ?>images/1x1.gif" width="1" height="1"></td>

                    </tr>

                    <tr>

                      <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">

                        <tr>

                          <td width="11" class="lshadow">&nbsp;</td>

                          <td valign="top" bgcolor="#71B2F2"><table width="100%"  border="0" cellspacing="0" cellpadding="0">

                              <?php include("../home_header.php")?>

                            <tr>

                              <td valign="top" colspan="2" align="center"><table width="79%"  border="0" cellspacing="0" cellpadding="0">

                                <tr>

                                  <td width="100%" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">                                                                

                                    <tr>

                                      <td><table width="100%"  border="0" cellspacing="0" cellpadding="0">

                                        <tr>

                                          <td align="left" valign="top" bgcolor="#EAEDF4"><img src="<?php echo $SITEURL ?>images/white_curve_tl.jpg" width="25" height="14"></td>

                                          <td bgcolor="#EAEEEF">&nbsp;</td>

                                          <td width="25" align="right" valign="top" bgcolor="#EAEEEF"><img src="<?php echo $SITEURL ?>images/white_curve_tr.jpg" width="25" height="14"></td>

                                        </tr>                                    

                                        <tr>

                                          <td width="25" align="left" class="lshadowwhite">&nbsp;</td>

                                          <td align="left" valign="top" bgcolor="#EAEEEF" width="705"><table width="86%"  border="0" cellspacing="0" cellpadding="0">

                                              <tr>

                                                <td align="left" valign="top">

                                                <div id="buttonsRow" style="padding: 8px; background-color: #CCCCCC; width: 100%;height:20px;">

                                                  <span id="buttonCopy" style="float:left;">

                                                      <strong><?php echo $user[username?>'s 

                                                        <?php 

                                                            
    echo $lang['comments'];

                                                        
    ?>

                                                    </strong>

                                                  </span>                                                            

                                                </div>    

                                                </td>

                                              </tr>                                        

                                              <tr>

                                                <td align="left" valign="top">

                                                    <table width="100%" cellspacing="0" cellpadding="10">

                                                   <?php                                                 

                                                    
    if($num_comments 0)

                                                    {                                                    

                                                        for(
    $k=0;$k<$num_comments;$k++)

                                                        {

                                                            
    $bgColor "";

                                                            
    $row_comments mysql_fetch_array($result_comments);

                                                            
    $user_comments select_user_from_video($row_comments[comment_from_id]);

                                                            if(
    $user_comments[user_image] == '')

                                                            {

                                                                
    $display_member_image $DEFAULT_USER_IMAGE;

                                                            }

                                                            else

                                                            {

                                                                
    $display_member_image $user_comments[user_image];

                                                            }

                                                            if(
    $k%== 1)

                                                            {

                                                                
    $bgColor "#EAEEEF";

                                                            }                                                                    

                                                   
    ?>

                                                     <tr bgcolor="<?php echo $bgColor ?>">

                                                         <td width="22%" valign="top" align="center">

                                                             <div align="center">

                                                                <a href="<?php echo $SITEURL ?>profile.php?user_id=<?php echo $user_comments[id?>&ch=u&fla=profile">

                                                                <img src="<?php echo $SITEURL ?>user_image/<?php echo $display_member_image ?>" width="100" height="100" border="0">

                                                                </a>

                                                             </div>

                                                         </td> 

                                                         <td width="78%" align="left" valign="top" bgcolor="<?php echo $bgColor ?>">

                                                            <?php echo stripslashes($row_comments[user_comment])?>    

                                                         </td>

                                                     </tr>

                                                    <?php 

                                                        
    }

                                                    }

                                                    else

                                                    {

                                                    
    ?>

                                                    <tr>                                                                

                                                         <td align="left" valign="top" bgcolor="#EAEEEF" colspan="2">&nbsp;                                                            

                                                         </td>

                                                    </tr>

                                                    <tr>                                                                

                                                         <td align="center" valign="top" bgcolor="#EAEEEF" colspan="2">

                                                            <?php 

                                                                
    echo $lang['msg49'];

                                                            
    ?>

                                                         </td>

                                                     </tr>

                                                     <tr>                                                                

                                                         <td align="left" valign="top" bgcolor="#EAEEEF" colspan="2">&nbsp;                                                            

                                                         </td>

                                                    </tr>

                                                    <?php

                                                    
    }

                                                    
    ?>

                                                   </table>

                                                </td>

                                              </tr>    

                                              <tr bgcolor="#EAEEEF">                                            

                                             <td>

                                                    <?php echo PrevNextGenerate($PageNo,$QUERY_STRING,$PHP_SELF,$totalpages); ?>

                                             </td>

                                            </tr>                                    

                                          </table></td>

                                          <td align="right" class="rshadowwhite">&nbsp;</td>

                                        </tr>                                                                        

                                        <tr>

                                          <td align="left"><img src="<?php echo $SITEURL ?>images/white_curve_bl.jpg" width="25" height="18"></td>

                                          <td class="bottomshadowwhite">&nbsp;</td>

                                          <td align="right"><img src="<?php echo $SITEURL ?>images/white_curve_br.jpg" width="25" height="18"></td>

                                        </tr>

                                      </table></td>

                                    </tr>

                                    <tr>

                                      <td>&nbsp;</td>

                                    </tr>

                                  </table></td>                              

                                </tr>

                              </table></td>

                            </tr>

                          </table></td>

                          <td width="10" class="rshadow">&nbsp;</td>

                        </tr>

                      </table></td>

                    </tr>

                    <tr>

                      <td height="16" align="left" valign="top" background="<?php echo $SITEURL ?>images/bgblue_curve_bot.jpg"><img src="<?php echo $SITEURL ?>images/1x1.gif" width="1" height="1"></td>

                    </tr>

                  </table></td>

                </tr>

                <tr>

                  <td align="left" valign="top"><?php include("../bottom.php")?></td>

                </tr>

              </table></td>

              <td width="6"><img src="<?php echo $SITEURL ?>images/1x1.gif" width="1" height="1"></td>

            </tr>

          </table></td>

        </tr>

      </table>

    </div>

    </body>

    </html>

  • #2
    New Coder
    Join Date
    Jul 2006
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Change this
    PHP Code:
    $query_comments "select * from comments where comment_type = 'USER' and comment_id = '$user[id]' and status = 'ACTIVE' order by id"
    to this
    PHP Code:
    $query_comments "select * from comments where comment_type = 'USER' and comment_id = '$user[id]' and status = 'ACTIVE' order by id DESC"
    Good luck!

  • #3
    New Coder
    Join Date
    Jan 2007
    Posts
    13
    Thanks
    1
    Thanked 0 Times in 0 Posts
    thankss soooo much, it actually worked


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •