/    Sign up×
Community /Pin to ProfileBookmark

mysql php trouble

Hello.

i have this code bellow that is supposed to

1: give the user with most points of the day VIP,
2: reset all the points for the users when run

it’s a cron file and when run it only resets the points to 0 and do not do 1 ([I]give the user with most points of the day VIP[/I]) in the list above, can anyone se why this would not work? :/

[code=php]<?php
require_once(“global.php”);

$sqlReset = “UPDATE fc_users SET today_points=0, today_referred=0, requests_today=0, today_added=0”;
@mysql_query($sqlReset) or die(mysql_error());

$sqlReset = “DELETE FROM fc_users WHERE fid=’0′”;
@mysql_query($sqlReset) or die(mysql_error());

$result = mysql_query(“SELECT * FROM fc_users WHERE featured_status=’1′”)
or die(mysql_error());

while($row = mysql_fetch_array($result)){
$days = $row[‘featured_profile’] – 1;
$lower= mysql_query(“UPDATE fc_users SET featured_profile=’$days’ WHERE fid=”.$row[‘fid’].””);
echo “”. $days .” – “.$row[‘fid’].”<br>”;
if($days < 0) {
$remove = mysql_query(“UPDATE fc_users SET featured_status=’0′ WHERE fid=”.$row[‘fid’].””);
}
}

?>[/code]

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@JoeHoldcroftDec 09.2007 — at a glance, i'd say because you reset all the counts to 0 before checking for who got the most, so when you search for the user with the most points, they are all 0 because you just reset them, swap the order around of those two tasks and you'll probably be fine.
Copy linkTweet thisAlerts:
@izlikauthorDec 09.2007 — at a glance, i'd say because you reset all the counts to 0 before checking for who got the most, so when you search for the user with the most points, they are all 0 because you just reset them, swap the order around of those two tasks and you'll probably be fine.[/QUOTE]

no, right now the one query that is supposed to check for the most points is at the top :/ above the one that resets the points.

the error i get right now is

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/test/public_html/test.php on line 5

but i solve it :/
×

Success!

Help @izlik spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...