Note that there are some explanatory texts on larger screens.

plurals
  1. POQuery a database with text field and checkboxes
    text
    copied!<p>First i've passed entire days searching on internet and trying to find a solution on myself, but with no success.</p> <p>So now i'm here to ask for your help.</p> <p>The website is about sailing centers. </p> <p>I have a simple search form with a text field (city)and 4 checkboxes (club, school, shop, tour). THey are all also fields of a database .</p> <p>Table1 - <strong>sailingcenters</strong></p> <pre><code>------+----------+----------+--------+--------+---------+------- id name city club school shop tour ------+----------+----------+--------+--------+---------+-------- 1 Sail1 City1 1 0 0 1 2 Sail2 City2 1 1 0 0 3 Sail3 City3 0 1 1 0 </code></pre> <p>Let's say i want to show all the clubs and schools in Marseille. </p> <p>So i type Marseille in the city field and check CLUB and SCHOOL checkboxes. (I think it's clear that all those information have been inserted by the sailing centers during registration)</p> <p>I want to show all the sailing centers that are both CLUB and Schools, but also just schools or clubs.</p> <p>This is the key point. I sailing center could be both, or just club or school. </p> <p>I cannot figure out how to build a select statement to solve this problem. </p> <p>The point is that i have to combine the city and the checkboxes in the select statement. That 's what i'm not able to do.</p> <p>I want to specify that for the checkboxes i have created 4 different fields in the database. Is this ok? Or should i have to create just one text field and use the IMPLODE function to store and EXPLODE to retrieve data?</p> <p>Hope i've been clear.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload