![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Join Date: Nov 2001
Location: Redmond, WA
Posts: 2,727
|
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? |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Join Date: May 2007
Location: Los Angeles
Posts: 155
|
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
__________________
The coolest Porn Tube |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Confirmed User
Join Date: May 2007
Location: Los Angeles
Posts: 155
|
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 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
Confirmed User
Join Date: Nov 2001
Location: Redmond, WA
Posts: 2,727
|
Hey, thanks!
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
Confirmed User
Join Date: Nov 2001
Location: Redmond, WA
Posts: 2,727
|
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? |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
<&(©¿©)&>
Industry Role:
Join Date: Jul 2002
Location: Chicago
Posts: 47,882
|
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 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
Do Fun Shit.
Industry Role:
Join Date: Dec 2004
Location: OC
Posts: 13,393
|
PHP Code:
__________________
![]() “I have the simplest tastes. I am always satisfied with the best.” -Oscar Wilde |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 |
Confirmed User
Join Date: Nov 2001
Location: Redmond, WA
Posts: 2,727
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 |
Confirmed User
Join Date: Jun 2009
Location: Asheville, NC
Posts: 2,277
|
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
__________________
ICQ: 258-202-811 | Email: eric{at}bestxxxporn.com |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 |
Confirmed User
Join Date: Jun 2009
Location: Asheville, NC
Posts: 2,277
|
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
__________________
ICQ: 258-202-811 | Email: eric{at}bestxxxporn.com |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#11 |
Confirmed User
Join Date: Nov 2001
Location: Redmond, WA
Posts: 2,727
|
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? |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#12 |
Confirmed User
Join Date: Apr 2009
Posts: 1,319
|
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` ); ![]()
__________________
History will be kind to me for I intend to write it. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#13 | |
Confirmed User
Join Date: Nov 2001
Location: Redmond, WA
Posts: 2,727
|
Quote:
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |