...

View Full Version : code errors



markman641
11-14-2011, 01:35 AM
alright.. im back with another question. I have the following code:


<?

include ("config.php");


$rank1 = 'http://www.money4every1.net/images/ranks/1.jpg';
$rank2 = 'http://www.money4every1.net/images/ranks/2.jpg';
$rank3 = 'http://www.money4every1.net/images/ranks/3.jpg';
$rank4 = 'http://www.money4every1.net/images/ranks/4.jpg';
$rank5 = 'http://www.money4every1.net/images/ranks/5.jpg';
$rank6 = 'http://www.money4every1.net/images/ranks/6.jpg';
$rank7 = 'http://www.money4every1.net/images/ranks/7.jpg';
$rank8 = 'http://www.money4every1.net/images/ranks/8.jpg';
$rank9 = 'http://www.money4every1.net/images/ranks/9.jpg';
$user = 'admin';

$get_name = mysql_query("SELECT * from `members` WHERE `username` = 'admin'");
while($namerow = mysql_fetch_array($get_name))
$offerscompleted = $namerow["offerscompleted"];

if(10 < $offerscompleted && $offerscompleted < 20) {
mysql_query("update members set avatarurl='$rank1' WHERE username='admin'");
}
if(20 < $offerscompleted && $offerscompleted < 30) {
mysql_query("update members set avatarurl='$rank2' WHERE username='admin'");
}
if(30 < $offerscompleted && $offerscompleted < 40) {
mysql_query("update members set avatarurl='$rank3' WHERE username='admin'");
}
if(40 < $offerscompleted && $offerscompleted < 50) {
mysql_query("update members set avatarurl='$rank4' WHERE username='admin'");
}
if(50 < $offerscompleted && $offerscompleted < 60) {
mysql_query("update members set avatarurl='$rank5' WHERE username='admin';");
}
if(60 < $offerscompleted && $offerscompleted < 70) {
mysql_query("update members set avatarurl='$rank6' WHERE username='admin'");
}
if(70 < $offerscompleted && $offerscompleted < 80) {
mysql_query("update members set avatarurl='$rank7' WHERE username='admin'");
}
if(80 < $offerscompleted && $offerscompleted < 90) {
mysql_query("update members set avatarurl='$rank8' WHERE username='admin'");
}
if(90 < $offerscompleted && $offerscompleted < 100) {
mysql_query("update members set avatarurl='$rank9' WHERE username='admin'");
}

?>

and instead of having it say "admin" in every line i tried to make it where it used $user instead, but it didn't work for some reason.. i got a blank page. this is what i tried:



$user='admin';
if(90 < $offerscompleted && $offerscompleted < 100) {
mysql_query("update members set avatarurl='$rank9' WHERE username='$user'");
}

didnt seem to work.. any ideas?

Adee
11-14-2011, 04:09 AM
have u tried echoing out what offers completed actually is?

markman641
11-17-2011, 12:31 AM
i found a better way to do this. Thanks!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum