# What's wrong with my SQL query?

**URL:** <https://forum.kirupa.com/t/whats-wrong-with-my-sql-query/303966>\
**Category:** Uncategorized\
**Created:** [January 29, 2010, 7:51pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-sql-query/303966 "2010-01-29T19:51:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![natronp](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@natronp](https://forum.kirupa.com/u/natronp)\
**Post date:** [January 29, 2010, 7:51pm UTC](https://forum.kirupa.com/t/whats-wrong-with-my-sql-query/303966/1 "2010-01-29T19:51:10Z")

</div>

the query i wrote is failing to filter by the ‘type’ field:

$data = mysql\_query(“SELECT \* FROM phys WHERE location = ‘$sv’ OR location2 = ‘$sv’ **AND type = ‘resident’** ORDER BY lastName”

what the heck is wrong with me?
