Jump to content


Photo

unusual probelm


  • Please log in to reply
2 replies to this topic

#1 desithugg

desithugg
  • Members
  • PipPipPip
  • Advanced Member
  • 281 posts
  • LocationScarborough

Posted 11 August 2006 - 03:43 PM

okay the problem is sometimes i use the same type of query but it gets the username with a different spelling meaning sometimes all capital sometimes not.So when i check stuff like
<?
if ($owner != "$me")
{
echo "You do not own this item.";
exit;
}
?>
even when the username is same it ives that error is there anyway i can make it non case sensitive

#2 Kris

Kris
  • Staff Alumni
  • Advanced Member
  • 2,755 posts
  • LocationThe Internet

Posted 11 August 2006 - 03:45 PM

Force both of your variables to lower case with strtolower() and then compare them.

#3 shocker-z

shocker-z
  • Members
  • PipPipPip
  • Advanced Member
  • 864 posts
  • LocationNottingham

Posted 11 August 2006 - 03:46 PM

it should be

<?
if ($owner !== "$me")
{
echo "You do not own this item.";
exit;
}
?>

But if you want to do both as uncase sencitive you could use strlower ot strupper to make both variables either upper or lower

<?
if (strtolower($owner) !== strtolower($me))
{
echo "You do not own this item.";
exit;
}
?>


Regards
Liam
www: www.ukchat.ws | irc: irc.ukchat.ws chan: #blufudge




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users