How can I select and don’t show duplicates?
Actually, it’s showing like that: apple | apple | apples | apple
This is my code:
$search = $_GET['q'];
$query = "SELECT * FROM query WHERE searchquery LIKE '%$search%' AND searchquery <> '$search'";
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You already said the magic word: DISTINCT.
Note that it probably won’t work if you use
SELECT DISTINCT *because when you select*that means select all columns, including columns which have a unique constraint such as the primary key. Only select the columns you need – stay away from*in general, and especially so when usingDISTINCT.