help with a while loop

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

    help with a while loop

    Code:
    [COLOR=#000000][COLOR=#007700]if([/COLOR][COLOR=#0000BB]$action[/COLOR][COLOR=#007700]==[/COLOR][COLOR=#DD0000]"males"[/COLOR][COLOR=#007700]) 
    { 
      [/COLOR][COLOR=#0000BB]addonline[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]getuid_sid[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$sid[/COLOR][COLOR=#007700]),[/COLOR][COLOR=#DD0000]"Male Gallery"[/COLOR][COLOR=#007700],[/COLOR][COLOR=#DD0000]""[/COLOR][COLOR=#007700]); 
    [/COLOR][COLOR=#007700]
    echo [/COLOR][COLOR=#DD0000]"<body>"[/COLOR][COLOR=#007700]; 
       
      echo [/COLOR][COLOR=#DD0000]"<p align=\"center\"><small>"[/COLOR][COLOR=#007700]; 
      echo [/COLOR][COLOR=#DD0000]"<i><b><u>Male Users From $sitename</u></b></i>"[/COLOR][COLOR=#007700]; 
      echo [/COLOR][COLOR=#DD0000]"<br/><br/>"[/COLOR][COLOR=#007700]; 
      echo [/COLOR][COLOR=#DD0000]"</small></p>"[/COLOR][COLOR=#007700]; 
       [/COLOR][COLOR=#FF8000]//////ALL LISTS SCRIPT << 
       [/COLOR][COLOR=#0000BB]$uid1 [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]getuid_sid[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$sid[/COLOR][COLOR=#007700]);  
    [/COLOR][COLOR=#0000BB]$mid [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]$_GET[/COLOR][COLOR=#007700][[/COLOR][COLOR=#DD0000]"mid"[/COLOR][COLOR=#007700]]; 
        if([/COLOR][COLOR=#0000BB]$page[/COLOR][COLOR=#007700]==[/COLOR][COLOR=#DD0000]"" [/COLOR][COLOR=#007700]|| [/COLOR][COLOR=#0000BB]$page[/COLOR][COLOR=#007700]<=[/COLOR][COLOR=#0000BB]0[/COLOR][COLOR=#007700])[/COLOR][COLOR=#0000BB]$page[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#0000BB]1[/COLOR][COLOR=#007700]; 
        [/COLOR][COLOR=#0000BB]$noi [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]mysql_fetch_array[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]mysql_query[/COLOR][COLOR=#007700]([/COLOR][COLOR=#DD0000]"SELECT COUNT(*) FROM usergallery WHERE sex='M'"[/COLOR][COLOR=#007700])); 
    [/COLOR][COLOR=#0000BB]$num_items [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]$noi[/COLOR][COLOR=#007700][[/COLOR][COLOR=#0000BB]0[/COLOR][COLOR=#007700]]; [/COLOR][COLOR=#FF8000]//changable 
        [/COLOR][COLOR=#0000BB]$items_per_page[/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]5[/COLOR][COLOR=#007700]; 
        [/COLOR][COLOR=#0000BB]$num_pages [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]ceil[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$num_items[/COLOR][COLOR=#007700]/[/COLOR][COLOR=#0000BB]$items_per_page[/COLOR][COLOR=#007700]); 
        if(([/COLOR][COLOR=#0000BB]$page[/COLOR][COLOR=#007700]>[/COLOR][COLOR=#0000BB]$num_pages[/COLOR][COLOR=#007700])&&[/COLOR][COLOR=#0000BB]$page[/COLOR][COLOR=#007700]!=[/COLOR][COLOR=#0000BB]1[/COLOR][COLOR=#007700])[/COLOR][COLOR=#0000BB]$page[/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]$num_pages[/COLOR][COLOR=#007700]; 
        [/COLOR][COLOR=#0000BB]$limit_start [/COLOR][COLOR=#007700]= ([/COLOR][COLOR=#0000BB]$page[/COLOR][COLOR=#007700]-[/COLOR][COLOR=#0000BB]1[/COLOR][COLOR=#007700])*[/COLOR][COLOR=#0000BB]$items_per_page[/COLOR][COLOR=#007700]; 
    [/COLOR][COLOR=#0000BB]$sql [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#DD0000]"SELECT uid, id, imageurl FROM usergallery WHERE sex='M' ORDER BY id DESC LIMIT $limit_start, $items_per_page"[/COLOR][COLOR=#007700]; 
    [/COLOR][COLOR=#FF8000]///////////////////// part of the added code also.  
    [/COLOR][COLOR=#0000BB]$result [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]mysql_query[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$sql[/COLOR][COLOR=#007700]) or die([/COLOR][COLOR=#DD0000]"Error: " [/COLOR][COLOR=#007700]. [/COLOR][COLOR=#0000BB]mysql_error[/COLOR][COLOR=#007700]());  
    [/COLOR][COLOR=#FF8000]//// 
    [/COLOR][COLOR=#007700]echo [/COLOR][COLOR=#DD0000]"<p>"[/COLOR][COLOR=#007700]; 
        [/COLOR][COLOR=#0000BB]$items [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]mysql_query[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$sql[/COLOR][COLOR=#007700]); 
        echo [/COLOR][COLOR=#0000BB]mysql_error[/COLOR][COLOR=#007700](); 
        if([/COLOR][COLOR=#0000BB]mysql_num_rows[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$items[/COLOR][COLOR=#007700])>[/COLOR][COLOR=#0000BB]0[/COLOR][COLOR=#007700]) 
        { 
        while ([/COLOR][COLOR=#0000BB]$item [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]mysql_fetch_array[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$items[/COLOR][COLOR=#007700])) 
        { 
            [/COLOR][COLOR=#0000BB]$sql [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#DD0000]"SELECT rating FROM usergallery_rating WHERE imageid='"[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000BB]$item[/COLOR][COLOR=#007700][[/COLOR][COLOR=#0000BB]1[/COLOR][COLOR=#007700]].[/COLOR][COLOR=#DD0000]"'"[/COLOR][COLOR=#007700];         
            [/COLOR][COLOR=#0000BB]$imginfo [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]mysql_query[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$sql[/COLOR][COLOR=#007700]); 
            echo [/COLOR][COLOR=#0000BB]mysql_error[/COLOR][COLOR=#007700](); 
            if([/COLOR][COLOR=#0000BB]mysql_num_rows[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$imginfo[/COLOR][COLOR=#007700])>[/COLOR][COLOR=#0000BB]0[/COLOR][COLOR=#007700]) 
            { 
               while ([/COLOR][COLOR=#0000BB]$imginfos [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]mysql_fetch_array[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$imginfo[/COLOR][COLOR=#007700])){  
                  [/COLOR][COLOR=#0000BB]$ratingtotal [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]$ratingtotal [/COLOR][COLOR=#007700]+ [/COLOR][COLOR=#0000BB]$imginfos[/COLOR][COLOR=#007700][[/COLOR][COLOR=#0000BB]0[/COLOR][COLOR=#007700]];} 
            } 
            if([/COLOR][COLOR=#0000BB]$totalcomments[/COLOR][COLOR=#007700]<[/COLOR][COLOR=#0000BB]1[/COLOR][COLOR=#007700]){[/COLOR][COLOR=#0000BB]$totalcomments[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#0000BB]0[/COLOR][COLOR=#007700];}          
            [/COLOR][COLOR=#0000BB]$norm [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]mysql_fetch_array[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]mysql_query[/COLOR][COLOR=#007700]([/COLOR][COLOR=#DD0000]"SELECT COUNT(*) FROM usergallery_rating WHERE imageid='"[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000BB]$item[/COLOR][COLOR=#007700][[/COLOR][COLOR=#0000BB]1[/COLOR][COLOR=#007700]].[/COLOR][COLOR=#DD0000]"'"[/COLOR][COLOR=#007700])); 
            if ([/COLOR][COLOR=#0000BB]$norm[/COLOR][COLOR=#007700][[/COLOR][COLOR=#0000BB]0[/COLOR][COLOR=#007700]]>[/COLOR][COLOR=#0000BB]0[/COLOR][COLOR=#007700]){ 
            [/COLOR][COLOR=#0000BB]$rating [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]ceil[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$ratingtotal[/COLOR][COLOR=#007700]/[/COLOR][COLOR=#0000BB]$norm[/COLOR][COLOR=#007700][[/COLOR][COLOR=#0000BB]0[/COLOR][COLOR=#007700]]); 
            }else{[/COLOR][COLOR=#0000BB]$rating[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#0000BB]0[/COLOR][COLOR=#007700];} 
            [/COLOR][COLOR=#0000BB]$rated [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]mysql_fetch_array[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]mysql_query[/COLOR][COLOR=#007700]([/COLOR][COLOR=#DD0000]"SELECT COUNT(*) FROM usergallery_rating WHERE byuid='"[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000BB]$uid1[/COLOR][COLOR=#007700].[/COLOR][COLOR=#DD0000]"' and imageid ='"[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000BB]$item[/COLOR][COLOR=#007700][[/COLOR][COLOR=#0000BB]1[/COLOR][COLOR=#007700]].[/COLOR][COLOR=#DD0000]"'"[/COLOR][COLOR=#007700])); 
            [/COLOR][COLOR=#0000BB]$totalcomments [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]mysql_fetch_array[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]mysql_query[/COLOR][COLOR=#007700]([/COLOR][COLOR=#DD0000]"SELECT COUNT(*) FROM usergallery_rating WHERE imageid ='"[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000BB]$item[/COLOR][COLOR=#007700][[/COLOR][COLOR=#0000BB]1[/COLOR][COLOR=#007700]].[/COLOR][COLOR=#DD0000]"' and commentsyn ='Y'"[/COLOR][COLOR=#007700])); 
            [/COLOR][COLOR=#0000BB]$userinfo [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]mysql_fetch_array[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]mysql_query[/COLOR][COLOR=#007700]([/COLOR][COLOR=#DD0000]"SELECT name FROM users WHERE id='"[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000BB]$item[/COLOR][COLOR=#007700][[/COLOR][COLOR=#0000BB]0[/COLOR][COLOR=#007700]].[/COLOR][COLOR=#DD0000]"'"[/COLOR][COLOR=#007700])); 
            echo [/COLOR][COLOR=#DD0000]"<a href=\"index.php?action=viewuser&amp;who=$item[0]&amp;sid=$sid\"><b><i><u>$userinfo[0]</u></i></b></a><small>"[/COLOR][COLOR=#007700]; 
            if([/COLOR][COLOR=#0000BB]canratephoto[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$uid1[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000BB]$item[/COLOR][COLOR=#007700][[/COLOR][COLOR=#0000BB]0[/COLOR][COLOR=#007700]]) and ([/COLOR][COLOR=#0000BB]$rated[/COLOR][COLOR=#007700][[/COLOR][COLOR=#0000BB]0[/COLOR][COLOR=#007700]]==[/COLOR][COLOR=#0000BB]0[/COLOR][COLOR=#007700])) 
            { 
             echo [/COLOR][COLOR=#DD0000]"<br/><a href=\"usergallery.php?action=rate&amp;sid=$sid&amp;whoimage=$item[1]\">Rate This Photo</a>"[/COLOR][COLOR=#007700]; 
            } 
            if([/COLOR][COLOR=#0000BB]ishost[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]getuid_sid[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$sid[/COLOR][COLOR=#007700]))||(([/COLOR][COLOR=#0000BB]isowner[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]getuid_sid[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$sid[/COLOR][COLOR=#007700]))||(([/COLOR][COLOR=#0000BB]isheadadmin[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]getuid_sid[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$sid[/COLOR][COLOR=#007700]))))))) 
            { 
             echo [/COLOR][COLOR=#DD0000]" / <a href=\"usergallery.php?action=del&amp;sid=$sid&amp;whoimage=$item[1]\">Del</a>"[/COLOR][COLOR=#007700]; 
            } 
            if([/COLOR][COLOR=#0000BB]$uid1[/COLOR][COLOR=#007700]==[/COLOR][COLOR=#0000BB]$item[/COLOR][COLOR=#007700][[/COLOR][COLOR=#0000BB]0[/COLOR][COLOR=#007700]]) 
            { 
            echo [/COLOR][COLOR=#DD0000]" / <a href=\"usergallery.php?action=del&amp;sid=$sid&amp;whoimage=$item[1]\">Del</a>"[/COLOR][COLOR=#007700]; 
            } 
             if([/COLOR][COLOR=#0000BB]$uid1[/COLOR][COLOR=#007700]==[/COLOR][COLOR=#0000BB]$item[/COLOR][COLOR=#007700][[/COLOR][COLOR=#0000BB]0[/COLOR][COLOR=#007700]]) 
            { 
             echo [/COLOR][COLOR=#DD0000]"<br/><a href=\"genproc.php?action=upavg&amp;sid=$sid&amp;avsrc=$item[2]\">Use As profile pic</a>"[/COLOR][COLOR=#007700]; 
            } 
            
            echo [/COLOR][COLOR=#DD0000]"</small><br/><img src=\"$item[2]\" alt=\"$userinfo[0]\"/><br/>"[/COLOR][COLOR=#007700]; 
            echo [/COLOR][COLOR=#DD0000]"<small>Rating: $rating/10 (<a href=\"usergallery.php?action=votes&amp;sid=$sid&amp;whoimage=$item[1]\">$norm[0]</a> Votes)<br/><a href=\"usergallery.php?action=comments&amp;sid=$sid&amp;whoimage=$item[1]\">Comments</a>($totalcomments[0])"[/COLOR][COLOR=#007700]; 
            echo [/COLOR][COLOR=#DD0000]"</small><br/><a href=\"$item[2]\" alt=\"$userinfo[0]\"/>Download<br/>"[/COLOR][COLOR=#007700]; 
    [/COLOR][COLOR=#FF8000]////////////////////////my problem part 
    [/COLOR][COLOR=#007700]while([/COLOR][COLOR=#0000BB]$row [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]mysql_fetch_array[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000BB]$result[/COLOR][COLOR=#007700])){ 
    echo [/COLOR][COLOR=#DD0000]"<br/><a href=\"getpics.php?file=$row[id]&amp;sid=$sid\">Download test</a>"[/COLOR][COLOR=#007700]; 
    <[/COLOR][COLOR=#0000BB]br[/COLOR][COLOR=#007700]/>[/COLOR][COLOR=#DD0000]"; 
    } 
    //////////////////////// 
            echo "[/COLOR][COLOR=#007700]</[/COLOR][COLOR=#0000BB]small[/COLOR][COLOR=#007700]><[/COLOR][COLOR=#0000BB]br[/COLOR][COLOR=#007700]/><[/COLOR][COLOR=#0000BB]br[/COLOR][COLOR=#007700]/>[/COLOR][COLOR=#DD0000]"; 
            $ratingtotal = 0; 
             
        } 
        } 
         
        echo "[/COLOR][COLOR=#007700]</[/COLOR][COLOR=#0000BB]p[/COLOR][COLOR=#007700]>[/COLOR][COLOR=#DD0000]"; 
        echo "[/COLOR][COLOR=#007700]<[/COLOR][COLOR=#0000BB]p align[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#DD0000]"center\">"[/COLOR][COLOR=#007700]; 
        if([/COLOR][COLOR=#0000BB]$page[/COLOR][COLOR=#007700]>[/COLOR][COLOR=#0000BB]1[/COLOR][COLOR=#007700]) 
        { 
          [/COLOR][COLOR=#0000BB]$ppage [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]$page[/COLOR][COLOR=#007700]-[/COLOR][COLOR=#0000BB]1[/COLOR][COLOR=#007700]; 
          echo [/COLOR][COLOR=#DD0000]"<a href=\"usergallery.php?action=males&amp;sid=$sid&amp;page=$ppage\">«Prev</a> "[/COLOR][COLOR=#007700]; 
        } 
        if([/COLOR][COLOR=#0000BB]$page[/COLOR][COLOR=#007700]<[/COLOR][COLOR=#0000BB]$num_pages[/COLOR][COLOR=#007700]) 
        { 
          [/COLOR][COLOR=#0000BB]$npage [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#0000BB]$page[/COLOR][COLOR=#007700]+[/COLOR][COLOR=#0000BB]1[/COLOR][COLOR=#007700]; 
          echo [/COLOR][COLOR=#DD0000]"<a href=\"usergallery.php?action=males&amp;sid=$sid&amp;page=$npage\">Next»</a>"[/COLOR][COLOR=#007700]; 
        } 
        echo [/COLOR][COLOR=#DD0000]"<br/>$page/$num_pages<br/>"[/COLOR][COLOR=#007700]; 
        if([/COLOR][COLOR=#0000BB]$num_pages[/COLOR][COLOR=#007700]>[/COLOR][COLOR=#0000BB]2[/COLOR][COLOR=#007700]) 
        { 
          [/COLOR][COLOR=#0000BB]$rets [/COLOR][COLOR=#007700]= [/COLOR][COLOR=#DD0000]"<form action=\"usergallery.php\" method=\"get\"><p align=\"center\">"[/COLOR][COLOR=#007700]; 
         
        [/COLOR][COLOR=#0000BB]$rets [/COLOR][COLOR=#007700].= [/COLOR][COLOR=#DD0000]"<input name=\"page\" style=\"-wap-input-format: '*N'\" size=\"3\"/>"[/COLOR][COLOR=#007700]; 
        [/COLOR][COLOR=#0000BB]$rets [/COLOR][COLOR=#007700].= [/COLOR][COLOR=#DD0000]"<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>"[/COLOR][COLOR=#007700]; 
        [/COLOR][COLOR=#0000BB]$rets [/COLOR][COLOR=#007700].= [/COLOR][COLOR=#DD0000]"<input type=\"hidden\" name=\"action\" value=\"$action\"/>"[/COLOR][COLOR=#007700]; 
        [/COLOR][COLOR=#0000BB]$rets [/COLOR][COLOR=#007700].= [/COLOR][COLOR=#DD0000]"<input type=\"hidden\" name=\"view\" value=\"$view\"/>"[/COLOR][COLOR=#007700]; 
        [/COLOR][COLOR=#0000BB]$rets [/COLOR][COLOR=#007700].= [/COLOR][COLOR=#DD0000]"<input type=\"Submit\" value=\"Go To Page\" Name=\"Submit\"/></form>"[/COLOR][COLOR=#007700]; 
    
            echo [/COLOR][COLOR=#0000BB]$rets[/COLOR][COLOR=#007700]; 
        } 
        echo [/COLOR][COLOR=#DD0000]"</p>"[/COLOR][COLOR=#007700];  
      [/COLOR][COLOR=#FF8000]////// UNTILL HERE >>  
        [/COLOR][COLOR=#007700]echo [/COLOR][COLOR=#DD0000]"<p align=\"center\">"[/COLOR][COLOR=#007700]; 
       echo [/COLOR][COLOR=#DD0000]"<br/><br/><a href=\"usergallery.php?action=main&amp;sid=$sid\">«Back to Gallery</a><br/>"[/COLOR][COLOR=#007700]; 
        echo [/COLOR][COLOR=#DD0000]"<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>"[/COLOR][COLOR=#007700]; 
    echo [/COLOR][COLOR=#DD0000]"Home</a>"[/COLOR][COLOR=#007700]; 
      echo [/COLOR][COLOR=#DD0000]"</p>"[/COLOR][COLOR=#007700]; 
     echo[/COLOR][COLOR=#DD0000]"</body>"[/COLOR][COLOR=#007700]; 
    exit();  [/COLOR][/COLOR]
    trying to add a download link for the pics .i cant the link to either be at the top or the bottom of each pic. i just a list of the links and the pics.

    tried moving } around and it just puts the links in another place of the page .

    cheers
    Wapchat4u


    Topsites4u

    #2
    Try this
    PHP Code:
    if($action=="males"

      
    addonline(getuid_sid($sid),"Male Gallery",""); 

    echo 
    "<body>"
       
      echo 
    "<p align=\"center\"><small>"
      echo 
    "<i><b><u>Male Users From $sitename</u></b></i>"
      echo 
    "<br/><br/>"
      echo 
    "</small></p>"
       
    //////ALL LISTS SCRIPT << 
       
    $uid1 getuid_sid($sid);  
    $mid $_GET["mid"]; 
        if(
    $page=="" || $page<=0)$page=1
        
    $noi mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM usergallery WHERE sex='M'")); 
    $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 uid, id, imageurl FROM usergallery WHERE sex='M' ORDER BY id DESC LIMIT $limit_start$items_per_page"
    ///////////////////// part of the added code also.  
    $result mysql_query($sql) or die("Error: " mysql_error());  
    //// 
    echo "<p>"
        
    $items mysql_query($sql); 
        echo 
    mysql_error(); 
        if(
    mysql_num_rows($items)>0
        { 
        while (
    $item mysql_fetch_array($items)) 
        { 
            
    $sql "SELECT rating FROM usergallery_rating WHERE imageid='".$item[1]."'";         
            
    $imginfo mysql_query($sql); 
            echo 
    mysql_error(); 
            if(
    mysql_num_rows($imginfo)>0
            { 
               while (
    $imginfos mysql_fetch_array($imginfo)){  
                  
    $ratingtotal $ratingtotal $imginfos[0];} 
            } 
            if(
    $totalcomments<1)
                {
                    
    $totalcomments=0;
                }          
                
    $norm mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM usergallery_rating WHERE imageid='".$item[1]."'")); 
            if (
    $norm[0]>0)
                { 
                    
    $rating ceil($ratingtotal/$norm[0]); 
                }
            else
                {
                    
    $rating=0;
                } 
            
    $rated mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM usergallery_rating WHERE byuid='".$uid1."' and imageid ='".$item[1]."'")); 
            
    $totalcomments mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM usergallery_rating WHERE imageid ='".$item[1]."' and commentsyn ='Y'")); 
            
    $userinfo mysql_fetch_array(mysql_query("SELECT name FROM users WHERE id='".$item[0]."'")); 
            echo 
    "<a href=\"index.php?action=viewuser&amp;who=$item[0]&amp;sid=$sid\"><b><i><u>$userinfo[0]</u></i></b></a><small>"
            if(
    canratephoto($uid1$item[0]) and ($rated[0]==0)) 
                { 
                    echo 
    "<br/><a href=\"usergallery.php?action=rate&amp;sid=$sid&amp;whoimage=$item[1]\">Rate This Photo</a>"
                } 
            if(
    ishost(getuid_sid($sid))||((isowner(getuid_sid($sid))||((isheadadmin(getuid_sid($sid))))))) 
                { 
                    echo 
    " / <a href=\"usergallery.php?action=del&amp;sid=$sid&amp;whoimage=$item[1]\">Del</a>"
                } 
            if(
    $uid1==$item[0]) 
                { 
                    echo 
    " / <a href=\"usergallery.php?action=del&amp;sid=$sid&amp;whoimage=$item[1]\">Del</a>"
                } 
             if(
    $uid1==$item[0]) 
                { 
                    echo 
    "<br/><a href=\"genproc.php?action=upavg&amp;sid=$sid&amp;avsrc=$item[2]\">Use As profile pic</a>"
                } 
            
      
            echo 
    "<small>Rating: $rating/10 (<a href=\"usergallery.php?action=votes&amp;sid=$sid&amp;whoimage=$item[1]\">$norm[0]</a> Votes)<br/><a href=\"usergallery.php?action=comments&amp;sid=$sid&amp;whoimage=$item[1]\">Comments</a>($totalcomments[0])"
            echo 
    "</small><br/><a href=\"$item[2]\" alt=\"$userinfo[0]\"/>Download<br/>"
    ////////////////////////my problem part 
    while($row mysql_fetch_array($result)){ 
    echo 
    "</small><br/><img src=\"$item[2]\" alt=\"$userinfo[0]\"/><br/>";
    echo 
    "<br/><a href=\"getpics.php?file=$row[id]&amp;sid=$sid\">Download test</a>"
    <
    br/>"; 

    //////////////////////// 
            echo "
    </small><br/><br/>"; 
            
    $ratingtotal = 0; 
             
        } 
        } 
         
        echo "
    </p>"; 
        echo "
    <p align="center\">"
        if(
    $page>1
        { 
          
    $ppage $page-1
          echo 
    "<a href=\"usergallery.php?action=males&amp;sid=$sid&amp;page=$ppage\">«Prev</a> "
        } 
        if(
    $page<$num_pages
        { 
          
    $npage $page+1
          echo 
    "<a href=\"usergallery.php?action=males&amp;sid=$sid&amp;page=$npage\">Next»</a>"
        } 
        echo 
    "<br/>$page/$num_pages<br/>"
        if(
    $num_pages>2
        { 
          
    $rets "<form action=\"usergallery.php\" method=\"get\"><p align=\"center\">"
         
        
    $rets .= "<input name=\"page\" style=\"-wap-input-format: '*N'\" size=\"3\"/>"
        
    $rets .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>"
        
    $rets .= "<input type=\"hidden\" name=\"action\" value=\"$action\"/>"
        
    $rets .= "<input type=\"hidden\" name=\"view\" value=\"$view\"/>"
        
    $rets .= "<input type=\"Submit\" value=\"Go To Page\" Name=\"Submit\"/></form>"

            echo 
    $rets
        } 
        echo 
    "</p>";  
      
    ////// UNTILL HERE >>  
        
    echo "<p align=\"center\">"
       echo 
    "<br/><br/><a href=\"usergallery.php?action=main&amp;sid=$sid\">«Back to Gallery</a><br/>"
        echo 
    "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>"
    echo 
    "Home</a>"
      echo 
    "</p>"
     echo
    "</body>"
    exit(); 
    libra.wen.ru

    Comment


      #3
      that just gives me 6 of the same picture .
      Wapchat4u


      Topsites4u

      Comment


        #4
        If you don't mind me asking why did you use the nested while loop? maybe if you remove the nested loop it will work
        libra.wen.ru

        Comment


          #5
          whats a nested loop . i just copied parts to try and make it work .but i have been looking at the query and realised i didnt need as much info in the result as i was collecting.

          Code:
          $sql = "SELECT id FROM usergallery WHERE sex='M' ORDER BY id DESC LIMIT $limit_start, $items_per_page";
          $result = mysql_query($sql) or die("Error: " . mysql_error()); 
          while($row = mysql_fetch_array($result)){
          $id = $row["id"];
          echo "<a href=\"getpics.php?file=$row[id]&amp;sid=$sid\">Download test</a>";
          }
          trimmed it down and took the imageurl and uid out .and now am getting the full 5 pics all in correct place. but also the full 5 download links on each of the pictures in a line.

          Added after 29 minutes:

          i have sorted it. without using any loops .
          Last edited by nclemale36; 07.09.11, 11:28.
          Wapchat4u


          Topsites4u

          Comment

          Working...
          X