This question already has an answer here:
I have a newbie question.
The "%" seems not working here whereas "Troyes" is in the database:
$requete = $bdd->query("SELECT * FROM club where ville='Tro%'")->fetchall();
But here the fetchall give me what I want:
$requete = $bdd->query("SELECT * FROM club where ville='Troyes'")->fetchall();
do you know what's wrong with the first query ?
Thank you for your help !
</div>
You need to replace =
with LIKE
, e.g.
SELECT * FROM club where ville LIKE 'Tro%'