devan Posted November 22, 2011 Share Posted November 22, 2011 I want to have a search product feature, but I would like members to be able to search multiple fields in one go i.e. product_code, Product_name in one MySQL query. The thing is, members have to be logged on, so the query must also only show results relating to that specific member, via the session[member_ID], my current query for listing products for that specific member is : $sql = "SELECT productId, productCode, image, name, price, stock_level FROM product_inventory WHERE memberr_ID = '" . $_SESSION['SESS_mem_ID'] . "; How would I change the above into a search query to search for productcode, productname and still only show results beloging to this member using the session data ? all help appreciated Link to comment https://forums.phpfreaks.com/topic/251603-mysql-query-to-search-multiple-fields-in-one-table/ Share on other sites More sharing options...
sunfighter Posted November 22, 2011 Share Posted November 22, 2011 It can't be this easy, I must have missed something. Your code: $sql = "SELECT productCode, name FROM product_inventory WHERE memberr_ID = '" . $_SESSION['SESS_mem_ID'] . "; You might have to change how this is displayed. Don't know, that code was not supplied. Give it a go. Link to comment https://forums.phpfreaks.com/topic/251603-mysql-query-to-search-multiple-fields-in-one-table/#findComment-1290492 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.