Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to search in 5 different fields with all possible choices in no particular order in MySQL using LIKE
    primarykey
    data
    text
    <p>I have a database which contains 5 fields, which are: name, address, idcard, town, street</p> <p>I then have a PHP query which accepts one parameter. In this parameter, you can enter whatever fields you like and the results must still be accurate.</p> <p>For example, if I enter john doe skate street in the search box you will get all the records whose name is John Doe and they live in the street known as Skate Street.</p> <p>Also, please note that the name is stored in one field in the order SURNAME NAME (I cannot change this because this is a must so please don't tell me that its better to change it... I know that :)). Obviously, I would like that the name can be entered in any order, be it NAME SURNAME or SURNAME NAME. </p> <p>My idea is to first attach the first two entered parameters as the name. I will tell my client that the first 2 parameters must be the name and surname or surname and name. Following the name, he may then enter any of the order attributes in whatever order he likes, i.e.</p> <p>These will be accepted:</p> <pre><code>name surname idcard town street surname name idcard town street name surname town idcard street surname name address street idcard </code></pre> <p>These will not be accepted:</p> <pre><code>idcard town name surname street town name surname idcard </code></pre> <p>for the simple reason that we will complicate the query too much (because of the name/surname reason, and them being in the same field)</p> <p>If there is a way how the latter is possible without a lot of complications, I would like to hear it as well.</p> <p>I would appreciate some help on this matter</p> <p>Many thanks in advance</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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