This is part of my code:

if ($group == 0) $cfg->errmsg ("Please select a group.$group");

Notice that there should be an error message if $group is zero. And then in the error message the value of $group is displayed.

So the script outputs this: Please select a group.Ontario

That means that $group is Ontarion and ZERO in the SAME TIME!!!!

WHT??

    If you're checking if a string is a number, most of the time, it returns -1, it might just be zero in your case. Don't try to check a string against a number, unless you convert it some how.

      What he had was suffient. He Doesnt need the === as that will make sure its identical which is not required.

      $group should actually be the Goup names id instead of the Group itself.

        what do you mean by

        $group should actually be the Goup names id instead of the Group itself.

          He means you shouldn't use the name for the ID. I.e. this example:
          Person id #1 = Mordecai
          Person id #2 = George Bush
          Person id #3 = Pacman
          if ((person id #3) == "Pacman") { }
          this equals: if (3 == "Pacman"). Obviously, 3 does not equal Pacman. Therefore, you must use either:
          if ("Pacman" == "Pacman")
          or
          if ((person id #3) == (person id #3))

          Hope this helps, despite being a very confusing example that means almost nothing.

          In simple terms: stick with either an ID or a name, don't mix and match, since they're obviously not the same when measuring equality.

            Originally posted by Mordecai
            Hope this helps, despite being a very confusing example that means almost nothing.

            O_o

            w00t??

              Note that if you're check to see if a $var got set, then use isset:

              if (!isset($group)) die("Group var ain't set pa!");

              If it's set to nothing, then test for that:

              if ($group=="") die("witty error message goes here");

                Write a Reply...