SELECT * FROM clients WHERE staff_id_c = '$staff_id'
AND cust_id LIKE '%".$ycl."%'
OR adate LIKE '%".$ycl."%'
OR a_f_name LIKE '%".$ycl."%'
OR a_s_name LIKE '%".$ycl."%'
OR a_occupation LIKE '%".$ycl."%'
OR b_f_name LIKE '%".$ycl."%'
OR b_s_name LIKE '%".$ycl."%'
OR b_occupation LIKE '%".$ycl."%'
OR house_no LIKE '%".$ycl."%'
OR address1 LIKE '%".$ycl."%' OR address2 LIKE '%".$ycl."%'
OR postcode LIKE '%".$ycl."%' OR home_tel LIKE '%".$ycl."%'
OR work_tel LIKE '%".$ycl."%' order by a_s_name
Nasty and long I know, but I seem the have the main problem with this bit
WHERE staff_id_c = '$staff_id' and cust_id LIKE '%".$ycl."%' OR
. It does not take the staff ID into concern and just simply gets all records with any staff ID (It is set the staff ID).
THanks in advance 😃