vincej Posted November 22, 2012 Share Posted November 22, 2012 Hi - I feel like I have tried everything. I am trying to do a search of my customer and orders tables where I allow search terms including "email". It works fine when I only search for "telephone" or "name" but it will not find customer by "email". What is even more bizaar is that it does work perfectly when I run it locally on my Xampp server. But when I upload it to my ISP it just will not find "email". SELECT customerid, order.orderid,order.status,order.pickupdate,customer.firstname,customer.lastname,customer.address,customer.phonenumber,customer.cellphone,customer.email,customer.id FROM `order` inner JOIN `customer` ON customer.id = customerid WHERE order.status = 'open' AND lastname LIKE '$term%' OR PhoneNumber LIKE '$term%' OR customer.email LIKE '$term% GROUP BY order.pickupdate ORDER BY order.customerid ASC any thoughts ?? Many Thanks !! Quote Link to comment https://forums.phpfreaks.com/topic/271053-why-wont-this-query-work/ Share on other sites More sharing options...
Barand Posted November 22, 2012 Share Posted November 22, 2012 (edited) Use (..) when mixing AND and OR SELECT customerid, order.orderid,order.status,order.pickupdate,customer.firstname,customer.lastname,customer.address,customer.phonenumber,customer.cellphone,customer.email,customer.id FROM `order` inner JOIN `customer` ON customer.id = customerid WHERE order.status = 'open' AND ( lastname LIKE '$term%' OR PhoneNumber LIKE '$term%' OR customer.email LIKE '$term%' ) GROUP BY order.pickupdate ORDER BY order.customerid ASC Edited November 22, 2012 by Barand Quote Link to comment https://forums.phpfreaks.com/topic/271053-why-wont-this-query-work/#findComment-1394529 Share on other sites More sharing options...
vincej Posted November 22, 2012 Author Share Posted November 22, 2012 thanks Barand, but unfortunately it didn't work. I could scream ... ) Quote Link to comment https://forums.phpfreaks.com/topic/271053-why-wont-this-query-work/#findComment-1394534 Share on other sites More sharing options...
Barand Posted November 22, 2012 Share Posted November 22, 2012 Only you know what is in $term and what is in your data. So not much we can do really. Quote Link to comment https://forums.phpfreaks.com/topic/271053-why-wont-this-query-work/#findComment-1394535 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.