Need help with a php statement...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Starfight
Forum Newbie
Posts: 1
Joined: Tue Jan 04, 2011 7:26 pm

Need help with a php statement...

Post by Starfight »

Hi!

I have a problem with the following statement:

Code: Select all

    $dbres				= mysql_query("SELECT UNIX_TIMESTAMP(`huur`) AS `huur`,huur1,`login`,UNIX_TIMESTAMP(`signup`) AS `signup`,`attack`,`defence`,`clicks`,`attlosses`,`attwins`,`deflosses`,`defwins`,`cash`,`type`,`clan`,'maffiamode',`avaurl` FROM `[users]` WHERE `login`='{$_GET['x']}'");
    if($def = mysql_fetch_object($dbres)) {
      if($def->login == $data->login){
	    print "  <tr><td class=\"mainTxt\">You kicked yourself in the nuts... now what?.</td></tr>\n";
      }else if($def->login == $admin1)
        print "  <tr><td class=\"mainTxt\">Do NOT attack an admin!</td></tr>\n";
else if($def->maffiamode == 1)
        print "  <tr><td class=\"mainTxt\">This pirate is currently under Davy Jones' protection!!</td></tr>\n";}
      else {
Even when $def->maffiamode == 1
really is set to 1 in the database
it still doesn't display the message...

The first 2 statements (

Code: Select all

if($def->login == $data->login){
and

Code: Select all

      }else if($def->login == $admin1)
work without a problem

need any further info?
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: Need help with a php statement...

Post by social_experiment »

'maffiamode' is different from all the other values which are `value`. Maybe it's that?
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Post Reply