Sql Query Needed...

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

    Sql Query Needed...

    Hello ppl... i want to create a page which shows top 10 people on the basis of number of buds they have...
    Like one person have 20 buds, other have 35 and other have 50 buds, then the one with 50 buds shoud be on the top, then the one with 35 buds, then the one with 20 buds...
    I am using lavalair script.. what would be the SQL query for the same?? (Remember its lavalair database) I tried like hell... but cant succeed.....
    Any help would be much appreciated.. thanx..

    #2
    Open lists.php and use 1 of those hundrets of pages lol... Just replace sql query with what u need/want...
    sigpiceeeeerrr....

    Comment


      #3
      I have already tried that..@Alesh Top posters, top chatters etc is easy.. But finding out people with most buddies is tricky... That buddies table is different...

      Comment


        #4
        put this code in index.php under $action=="viewuser"
        Code:
        $budnum = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_buddies WHERE (uid='".$who."' OR tid='".$who."') AND agreed='1'"));
        mysql_query("ALTER TABLE ibwf_users ADD bud INT( 100 ) NOT NULL DEFAULT '".$budnum[0]."' AFTER posts");

        then make $action=="topbuds" like $action=="topp" in lists.php using the code
        Code:
         $sql = "SELECT id, name, bud FROM ibwf_users ORDER BY posts DESC LIMIT $limit_start, $items_per_page";
        then you yourself view all members profile once to work
        Code:
        mysql_query("ALTER TABLE ibwf_users ADD bud INT( 100 ) NOT NULL DEFAULT '".$budnum[0]."' AFTER posts")
        for all members

        Comment


          #5
          Thanx rukiya... So it means all profiles has to be viewed once... to execute that query... Hmm..

          Comment


            #6
            guys whats the query to fetch random pics from gallery?
            Failure is not when a girls leaves you, its only when you let her go virgin. heheh!!

            <span style="color:#9ACD32"><span style="font-size:36pt;line-height:100%">BEST MOBILE ADVERTISER</span></span>

            Comment


              #7
              guys whats the query to fetch random pics from gallery?[/b]
              Code:
              $image = mysql_fetch_array(mysql_query("SELECT id, imageurl FROM gallery ORDER BY RAND()  LIMIT 1"));
              echo "<img src=\"$image[1]\" alt=\"$image[0]\"/>
              ";

              Comment


                #8
                bro the code is giving me error
                Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/index.php on line 4774
                Failure is not when a girls leaves you, its only when you let her go virgin. heheh!!

                <span style="color:#9ACD32"><span style="font-size:36pt;line-height:100%">BEST MOBILE ADVERTISER</span></span>

                Comment


                  #9
                  bro the code is giving me error
                  Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/index.php on line 4774[/b]
                  post here your mysql table for gallery

                  Comment

                  Working...
                  X