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!
I have had a heck of a time figuring this out and it is driving me crazy!! lol. I am trying to make an SQL query meet several requirements from the table before the results are displayed. Here is the statement I am working with:
$searchresult = mysql_query("SELECT * FROM coupons WHERE category_id='5' AND coupon_zip='89118'");
I want it to only pull rows from the database where both the category ID match AND the coupon ZIP match. Unfortunately no matter how many times I try it it still provides me with rows that have either one or both of the requirements. Am I doing something wrong? Any help would be appreciated.
Hi, I have tried your query and there is no problem in it. Its working fine with me. If you still have any error then let me know with more code as to find out where is the exact problem.
I just tried breaking it down and it works perfectly when I run the query like that.. However, I just noticed that the problem starts and I get unexpected results when I run the query like this: