MySQL ignoring parameter
Hello, I'm having a strange problem where I'm doing a search based on a query string and set value for partnerfor the set value is 456 and the query string looks like ?q=admin, this should return no records because the partnerfor field for the admin is 123 but it's returning the admin record, can anyone help me or tell me what's wrong with this recordset, the qget variable is basically just a $_GET['q'], many thanks.
<?php
$search = new WA_MySQLi_RS("search",$securex,100);
$search->setQuery("SELECT users.id, users.email, users.dispname, users.xkey, users.logindate, users.loginfrom, users.accesslevel, users.datepasschanged, users.picture, users.disabled, users.lockedout, users.lockedoutcount, users.extlockedout, users.authorised, users.delete_date, users.temppic_start, users.temppic_expire, users.schedpic, users.partner_id, users.forpartner, acceslevels.leveldescription FROM users INNER JOIN acceslevels ON users.accesslevel = acceslevels.id WHERE users.forpartner = ? AND users.email = ? OR users.dispname = ? OR users.loginfrom = ? ORDER BY users.dispname ASC");
$search->bindParam("s", "".$_SESSION['piid'] ."", "-1"); //WAQB_Param1
$search->bindParam("s", "".$qget ."", "-1"); //WAQB_Param2
$search->bindParam("s", "".$qget ."", "-1"); //WAQB_Param3
$search->bindParam("s", "".$qget ."", "-1"); //WAQB_Param4
$search->execute();
?>
I've added some screenshots below, phpmyadmin returns the correct result of no records but the above SQL statement returns the admin record
SORTED NOW
The mistake was display name was acting independently I had to enter forpartner AND email OR forpartner AND dispname, Thanks