Jump to content


Photo

Problem with select using = instead of like


  • Please log in to reply
1 reply to this topic

#1 MOnkman

MOnkman
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 09 April 2003 - 10:01 AM

When using this:

$_player_num = 15;

$query = \"select * from players where player_num = \'%\".$_player_num.\"%\'\";

I get no results however, when using ........player_num like \'......... instead i get a returned result for this but it would also return a result had $_player_num been 5, even though it didnt exist.

I am confused and frustrated, please help!!!

#2 DocSeuss

DocSeuss
  • Members
  • PipPipPip
  • Advanced Member
  • 73 posts
  • LocationTexas, USA

Posted 09 April 2003 - 10:15 AM

You can\'t use wildcards \"%\" in an = SELECT

what exactly are you trying to find matches for if it\'s anything with a \'15\' in it use.

$query = \"SELECT * FROM palyers WHERE player_num LIKE \'%$_player_num%\'\";
"Unlimited budget? Great, for $5,000,0000 we will run your ad banner for one year"  ----Rasmus Lerdorf




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users