Solarpitch Posted January 10, 2009 Share Posted January 10, 2009 Hey Guys, The below image is an example of the search on my site. Basically in this example, the user wants to search the phones table and return phones that are on the O2 or Meteor network, and that have a flip style. I have 2 tables for this, networks and styles. //networks id network phone_id 1 o2 1 2 meteor 1 3 o2 2 //styles id style phone_id 1 flip 1 2 touchscreen 2 3 slider 3 How can I tell what check boxes the user has selected, and then format a query for it. Even if I had the essentials I could do the rest myself. See, the way I have it done there would need to be 3 queries.. 1: to query networks 2: to query styles with the results returned from networks 3: to query the actual phones table to return the all the phones Link to comment https://forums.phpfreaks.com/topic/140287-help-needed-with-structuring-a-query-after-submit-example-shown/ Share on other sites More sharing options...
gevans Posted January 10, 2009 Share Posted January 10, 2009 You can use a table join to do it with one query example; SELECT `mainphonetable`.`phone`, `networks`.`network`, `styles`.`style` FROM `mainphonetable` INNER JOIN `networks` ON `mainphonetable`.`phone` = `networks`.`phone_id` INNER JOIN `styles` ON`mainphonetable`.`phone` = `styles`.`phone_id` WHERE `styles`.`style` = 'flip' AND `networks`.`network` = 'O2' Link to comment https://forums.phpfreaks.com/topic/140287-help-needed-with-structuring-a-query-after-submit-example-shown/#findComment-734060 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.