PHP / MySQL Help!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • galleryseek
    Confirmed User
    • Mar 2002
    • 8234

    #1

    PHP / MySQL Help!

    ok just a few questions, unfortunately my coder is a fatass lazy piece of shit so i'm attempting this, if you can prove helpful i'll use you on the project.. its just a big move to remove the current programmer cause this is such a big ass project... anyhow...

    This is a table that I'm currently working with.


    What I want to do is print out, "You have performed X amount of Exercises"... the initial coding i assume would go like this:

    $query = "SELECT abrv FROM bgusers WHERE uid=$uid";
    $result = mysql_query($query);

    then how do you take the $result and exclude the duplicates then find out how many individual exercises there are after duplicates have been removed? i assume there is some kind of duplicate removing function in php...

    I assume this isn't too difficult for most coders out there...

    thx ;)
  • sixxxth_sense
    So Fucking Banned
    • Nov 2003
    • 2430

    #2
    I'm a coder and i'm 2 lazy to read the post!
    So i'll give her a bump, it looks eazy

    Comment

    • fuzebox
      making it rain
      • Oct 2003
      • 22365

      #3
      Change your query...

      $query = "SELECT abrv, count(*) AS total FROM bgusers WHERE uid=$uid" GROUP BY abrv;
      $result = mysql_query($query);

      Now when you mysql_fetch_array() or whatever your $result, you'll get a $result["abrv"] and a $result["total"] for each excercise.

      Cheers

      Comment

      • SMG
        Confirmed User
        • Aug 2003
        • 1798

        #4
        its faster if you just do it with the mysql using the distinct keyword
        $query = "SELECT DISTINCT abrv, count(*) AS total FROM bgusers WHERE uid=$uid" GROUP BY abrv;
        TGP Webmasters: sign up for the top 100 tgp list!
        Submit galleries
        If you add me to icq (title) make sure to mention GFY or I'll think you're a bot and deny you.

        Comment

        • fuzebox
          making it rain
          • Oct 2003
          • 22365

          #5
          Originally posted by SMG
          its faster if you just do it with the mysql using the distinct keyword
          $query = "SELECT DISTINCT abrv, count(*) AS total FROM bgusers WHERE uid=$uid" GROUP BY abrv;
          pfft

          Comment

          • SMG
            Confirmed User
            • Aug 2003
            • 1798

            #6
            lol I pasted from the wrong post but I guess it still works, however that " at the end of the select line should be moved to the end of course...
            TGP Webmasters: sign up for the top 100 tgp list!
            Submit galleries
            If you add me to icq (title) make sure to mention GFY or I'll think you're a bot and deny you.

            Comment

            • woj
              <&(©¿©)&>
              • Jul 2002
              • 47880

              #7
              Is it just me or is that table really poorly designed?
              Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000
              Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager
              Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager

              Comment

              • johnbosh
                Confirmed User
                • Aug 2002
                • 8965

                #8
                Originally posted by woj
                Is it just me or is that table really poorly designed?
                not me

                Comment

                • Voodoo
                  ♥ ♦ ♣ ♠
                  • Sep 2002
                  • 10600

                  #9
                  PHP Code:
                  function contactTechSupport( $call = "1-888-TECH-SUP";) if($mysql != "work"){  contactTechSupport(); } 
                  

                  "I'm selflessly supporting the common good, but only coincidentally looking out for No.1."

                  Comment

                  • SMG
                    Confirmed User
                    • Aug 2003
                    • 1798

                    #10
                    Originally posted by woj
                    Is it just me or is that table really poorly designed?
                    heh, I'd like to know whats up with that data column ... but then again maybe it doesnt require indexing ever on that so it might be fine
                    TGP Webmasters: sign up for the top 100 tgp list!
                    Submit galleries
                    If you add me to icq (title) make sure to mention GFY or I'll think you're a bot and deny you.

                    Comment

                    • galleryseek
                      Confirmed User
                      • Mar 2002
                      • 8234

                      #11
                      thx for the help.. but im still having fucking problems...

                      $query = "SELECT DISTINCT abrv FROM bgexercises WHERE uid=$_SESSION[userid]";
                      $resultss3 = mysql_query($query);
                      $shit = mysql_num_rows($resultss3);
                      print "$shit";

                      and its not printing dick.

                      i didn't use all of your guys's coding cause i tried it and it didn't work.. all i'm trying to do is get how many different exercises there are n' thats it... god damn i hate this shit

                      Comment

                      • galleryseek
                        Confirmed User
                        • Mar 2002
                        • 8234

                        #12
                        ooops! i was using "uid" instead of "userid". ;) it works now....

                        Comment

                        • galleryseek
                          Confirmed User
                          • Mar 2002
                          • 8234

                          #13
                          okay.. heres the next one, its a lot more complex... i want to do something like this:

                          "You have GAINED STRENGTH on over 2 different exercises within the past MONTH "

                          this focuses specifically on the "data" field. we figure out the strength increase by this formula (using the first row from the picture up top):

                          (35 * 15 + 50 * 10 + 80 * 8) / 3

                          now what we'd have to do is somehow be able to group the strings according to ABRV, and compare "data" from 1 month ago of each exercise, to NOW... and determine if there has been a strength gain.. then print the results.

                          LOL, sounds like a bunch of shit.. thought i'd post it anyhow... if someone can get it right i'll paypal $30 if that'll raise incentive. if you're interested & need more specifics.. just post.

                          Comment

                          • Alky
                            Confirmed User
                            • Apr 2002
                            • 5651

                            #14
                            (35 * 15 + 50 * 10 + 80 * 8) / 3

                            thats a formula?

                            Comment

                            • Mr. Porno King
                              Confirmed User
                              • Aug 2003
                              • 146

                              #15
                              Give me a bit more data on ICQ, and I'll write the code you need within the hour. 172884621
                              My Favorite Game

                              Comment

                              • JDog
                                Confirmed User
                                • Feb 2003
                                • 7453

                                #16
                                If you want, contact me, I could help out with MYSQL/PHP. I've done the NSCash & ReelProfits affiliate area add-ons!

                                jDoG
                                NSCash now powering ReelProfits.com
                                ALSO FEATURING: NSCash.com :: SoloDollars.com :: ReelProfits.com :: BiminiBucks.com :: VOD
                                PROGRAMS COMING SOON: Greedy Bucks :: Vengeance Cash
                                NOW OFFERING OVER 60 SITES
                                CONTACT :: JAMES SMITH :: CHIEF TECHNOLOGY OFFICER :: ICQ (711385133)

                                Comment

                                • JDog
                                  Confirmed User
                                  • Feb 2003
                                  • 7453

                                  #17
                                  Originally posted by woj
                                  Is it just me or is that table really poorly designed?
                                  Yea I think so too! I don't like the design, but hey! I don't have a say!

                                  jDoG
                                  NSCash now powering ReelProfits.com
                                  ALSO FEATURING: NSCash.com :: SoloDollars.com :: ReelProfits.com :: BiminiBucks.com :: VOD
                                  PROGRAMS COMING SOON: Greedy Bucks :: Vengeance Cash
                                  NOW OFFERING OVER 60 SITES
                                  CONTACT :: JAMES SMITH :: CHIEF TECHNOLOGY OFFICER :: ICQ (711385133)

                                  Comment

                                  • Karlitos
                                    Registered User
                                    • Jul 2003
                                    • 70

                                    #18
                                    btw, it looks like PhpMyAdmin table when you get the result of a query!
                                    __________________________
                                    For all your web development needs, visit Progmatixxx.Com

                                    Comment

                                    Working...