SQL Query - return EXACT match on two parameters

edavo
edavo used Ask the Experts™
on
What if I want to add a second parameter to my query? I understand the % but I want the both the $th and $sport vars (below) to be an exact match, not a "like"...

This works for one parameter, but needs to be modified to be EXACT EQUALS, not LIKE:
$sql="SELECT * FROM schedules WHERE team LIKE '%".$tm."%' ORDER BY date";

This is not working for two, how do I add the second parameter (they are both being passed in a URL string:
$sql="SELECT * FROM schedules WHERE team LIKE '%".$tm."%' AND sport='%".$sport."%'ORDER BY date";
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
$sql="SELECT * FROM schedules WHERE team = '".$tm."' AND sport='".$sport."' ORDER BY date";

Author

Commented:
This is not working - I copied and pasted it in place and the code below appears broken (color coded) --- Something in this line is breaking the code...?

Author

Commented:
Fast Service = Happy customer - you guys are GREAT!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial