Her's my probleme, i guess its really basic.
I'm trying to lookup in the database if a line does exist. heres my code :
$req="SELECT * FROM INSTITUTS WHERE inst_name='$fc_inst'";
$result=mysql_query($req) or die ('Erreur :'.mysql_error());
if (mysql_num_rows($result)){
echo ' name exist';
}
else {
echo ' does not exist.';
}
Probleme is, when imm looking for "test", it says does not exist, even if i have "Test" in my database.
you can use LIKE
:
WHERE foo LIKE 'bar'
Or you can cast both lowercase with:
WHERE LOWER(foo) = LOWER("bar")
The example with LOWER()
is most effective where you know that all of your data in the database is already lower cased and then you can just execute:
WHERE foo = LOWER("bar")
This would be a cheaper comparison than the LIKE
if you can lower case all of the data in your database.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With