Updated the query to work, and changed the php code to the new SQL code