i have come across % symbol in mysql. here is my mysql_query statement.
SELECT `permAddr`, `Name` FROM `persons` WHERE `idCardNo` LIKE '%".$_POST['value']."%' LIMIT 1
my question now is what is the exact use of that symbol in the above statement. isnt it the modulus symbol ? ? ? any one have the answer ?
When used with
LIKEit means it’s being used as a wildcard. This means that it will match anything whenever the%is visible in the query.For example, if
$_POST['value']wasbird, that query would return rows whereidCardNomatchedbluebirdandbirdhouse.You can read more about this operator and others here: http://dev.mysql.com/doc/refman/5.0/en/string-comparison-functions.html#operator_like
Slightly off topic but relevant none the less is that your code is vulnerable to SQL Injection, you should look to use PDO in your projects.