0

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 !

Gromain
  • 123
  • 6

1 Answers1

3

You need to replace = with LIKE, e.g.

SELECT * FROM club where ville LIKE 'Tro%'
wogsland
  • 9,106
  • 19
  • 57
  • 93