query not working??


Below is the code for the query that im running. This code is running on the sub domain. The variable $uniname is set to the correct value stored in the db. The column is called uni_name.

The problem im having is that its returning all the results even if the AND statement isn’t meet. This same statement is working on the main website.

ALL other query’s work so i dont understand why this is failing…

Any ideas would be great thanks!


$searchQuery = “SELECT * FROM events WHERE eventType = ‘Participation sporting events’ OR eventType = ‘Watch live sporting event’ OR eventType = ‘Local team sporting event’ AND uni_name = '”.$uniname."’";

The code below has seemed to fix it if anyone else has the sme kinda problem

$searchQuery = “SELECT * FROM events WHERE uni_name = '”.$uniname."’ AND
(eventType LIKE ‘Particapation sporting events’ OR eventType LIKE
‘Watch live sporting event’ OR eventType LIKE ‘Local team sporting event’)";

Sponsor our Newsletter | Privacy Policy | Terms of Service