...

View Full Version : If 'userlevel = 2' PROBLEM! =(



2Pacalypse
08-03-2008, 10:13 PM
Alright so I trying something fun with my game... but this doesn't seem to do the trick (trying to make Admin (user level 2) names turn PINK! and have an image beside their names..)


if($r['donatordays']) { $r['username'] = "<font color=red>{$r['username']}</font>";$d="<img src='donator.gif' alt='Donator: {$r['donatordays']} Days Left' title='Donator: {$r['donatordays']} Days Left' />"; }
if($r['user_level'] = 2) { $r['username'] = "<font color=pink>{$r['username']}</font>";$d="<img src='sexy.gif' title='Admin: They own you.' />"; }


Anyone wanna help fix it?

EDIT:

It usually turns out that the Admin names are red (they are donators) and the rest for some reason get the sexy image and pink name lol

djm0219
08-03-2008, 10:17 PM
The = is an assignment operator so you are setting the user_level to 2 in the second if. Use == instead like so:


if($r['user_level'] == 2) { $r['username'] = "<font color=pink>{$r['username']}</font>";$d="<img src='sexy.gif' title='Admin: They own you.' />"; }

GJay
08-03-2008, 10:17 PM
= is assignment, == is a test for equality.

2Pacalypse
08-03-2008, 10:25 PM
Thanks so much!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum