Any Programmers Around Today?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Bama
    Confirmed User
    • Nov 2001
    • 2727

    #1

    Any Programmers Around Today?

    I have a question and maybe one of you can help me.

    What I want to do is find a customer record in a db.

    I need x to be equal to or greater than 1000 and y to be equal to or greater than 95% of x and if so - delete the customer record written out in a php code.

    Anyone help?
  • Sex9
    Confirmed User
    • May 2007
    • 155

    #2
    Here is a tibit a code I used on one of my games
    $x = 1000;
    $y = 950;
    $result = mysql_query ("SELECT * FROM $table WHERE x > '$x' && y > '$y' ORDER BY id DESC");
    $nRows = mysql_num_rows($result);

    for ($i=0; $i< $nRows; $i++){
    $row = mysql_fetch_array($result);
    $theid = $row['id'];
    $query124 = "DELETE FROM $table WHERE id= '$theid'";
    mysql_query($query124) or die;
    }
    I am self taught and make no guarantees, but that worked for me
    Last edited by Sex9; 08-16-2009, 05:54 PM.
    The coolest Porn Tube

    Comment

    • Sex9
      Confirmed User
      • May 2007
      • 155

      #3
      oops, just saw where you wanted y to always be 95% of x so I revised it a bit
      $x = 1000;
      $y = 950;
      $result = mysql_query ("SELECT * FROM $table WHERE x > '$x' && y > '$y' ORDER BY id DESC");
      $nRows = mysql_num_rows($result);

      for ($i=0; $i< $nRows; $i++){
      $row = mysql_fetch_array($result);
      $theid = $row['id'];
      $x2 = $row['x'];
      $y2 = $row['y'];
      if($y2 > ($x2 * .95)){
      $query124 = "DELETE FROM $table WHERE id= '$theid'";
      mysql_query($query124) or die;
      }
      }
      The coolest Porn Tube

      Comment

      • Bama
        Confirmed User
        • Nov 2001
        • 2727

        #4
        Hey, thanks!

        Comment

        • Bama
          Confirmed User
          • Nov 2001
          • 2727

          #5
          Acck - need a little revision to this if anyone else care's to help out! (changed variables and added 1)

          I need:

          x to be 500 OR GREATER
          y to be 95% of X OR GREATER and IF
          z is less than X - delete the record

          but if

          z is greater than X - disregard Y and keep the record

          Anyone help?

          Comment

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

            #6
            homework help? eh?
            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

            • munki
              Do Fun Shit.
              • Dec 2004
              • 13393

              #7
              PHP Code:
              $evil = 666;
              $money = sqrt($evil); //Money is the root of all evil
              $time = $money; //Time is money
              $women = $time*$money; //Women require time and money
              
              if ($women == $evil) {echo 'Women are evil';}
              if ($women != $evil) {error_log('Thats fucking impossible, 0');} 
              

              I have the simplest tastes. I am always satisfied with the best.” -Oscar Wilde

              Comment

              • Bama
                Confirmed User
                • Nov 2001
                • 2727

                #8
                Originally posted by woj
                homework help? eh?
                LOL! No!

                Comment

                • BestXXXPorn
                  Confirmed User
                  • Jun 2009
                  • 2277

                  #9
                  I'll post something ... can you give actual field names and some sample values?

                  In fact you shouldn't even need PHP for this if you're trying to do what I think you are :P
                  Last edited by BestXXXPorn; 08-28-2009, 09:17 AM.
                  ICQ: 258-202-811 | Email: eric{at}bestxxxporn.com

                  Comment

                  • BestXXXPorn
                    Confirmed User
                    • Jun 2009
                    • 2277

                    #10
                    From what you wrote (where x, y, and z are field names):

                    DELETE FROM `table` WHERE x >= 500 AND y>=(x * 0.95) AND z < x;

                    Might want to run a

                    SELECT * FROM `table` WHERE x >= 500 AND y>=(x * 0.95) AND z < x;

                    first to make sure you've got all the correct data in there... and I recommend backing up the table first too :P
                    Last edited by BestXXXPorn; 08-28-2009, 09:23 AM.
                    ICQ: 258-202-811 | Email: eric{at}bestxxxporn.com

                    Comment

                    • Bama
                      Confirmed User
                      • Nov 2001
                      • 2727

                      #11
                      Fights Won: 100 Fights Lost: 543
                      Opponents Killed: 68 Deaths: 505
                      Jobs Completed: 6375

                      OK, this is dumb, but at the same time take a bit of thought so you don't delete an account that doesn't fall into the criteria that's intended.

                      There's this online game where you can attack - be attacked or do jobs (or a mixture of both). If you do the jobs, you lose stats boosting points making you weaker than other opponents so you'll die more (deaths).

                      When a weak opponent attacks a strong opponent and dies - the stronger gets the stats boost so we call those weak account "padders". Accounts whose only purpose is to "pad" stronger opponents stats. Those are the ones we want to find and delete.

                      The stats shown above is a good example because it's primarily a job doer account - but is used to pad now and then as well. You can tell that because the fights lost and the deaths are pretty darn close (within 95%).

                      To keep from eliminating it, you have to have a higher job than fight lost ratio so that it's kept. That's why I set the minimum fights lost at 1000 (above dog doesn't meet that criteria so it would be kept)

                      But, that isn't a perfect solution either because what if the stats looked like this:

                      Fights Won: 100 Fights Lost: 543
                      Opponents Killed: 68 Deaths: 505
                      Jobs Completed: 75

                      Now we'd know (because of the low job's completed number) that this account is used to pad with - but doesn't meet the 1000 minimum number set - so we'd be missing alot of accounts to delete).

                      How would you go about scooping up all the padders without deleting an account that does the jobs?

                      Comment

                      • ProG
                        Confirmed User
                        • Apr 2009
                        • 1319

                        #12
                        I have no idea if this will help - I couldn't fully understand what you need from reading your posts so it's a shot in the dark.

                        Code:
                        DELETE FROM `dogs` WHERE  (`losses` >= 1000 AND ( ( `deaths` / `losses` ) * 100 ) > 90 ) OR ( ( ( `deaths` / `losses` ) * 100 ) > 90 AND `jobs` < `losses` );
                        lol @ dog fighting game
                        History will be kind to me for I intend to write it.

                        Comment

                        • Bama
                          Confirmed User
                          • Nov 2001
                          • 2727

                          #13
                          Originally posted by ProG
                          I have no idea if this will help - I couldn't fully understand what you need from reading your posts so it's a shot in the dark.

                          Code:
                          DELETE FROM `dogs` WHERE  (`losses` >= 1000 AND ( ( `deaths` / `losses` ) * 100 ) > 90 ) OR ( ( ( `deaths` / `losses` ) * 100 ) > 90 AND `jobs` < `losses` );
                          lol @ dog fighting game
                          Hey now - it's a fun time passer late at night when everyone you'd need to talk to on the east coast is in bed - and thanks!

                          Comment

                          Working...