Query result is different when executing a simple search in PHP <p>I am executing the following query in a MySQL database (look at SELECT AND WHERE, the rest is not important):</p> <pre><code>SELECT distinct fname //more fields... FROM filedepot_files AS ff INNER JOIN filedepot_categories AS fc ON ff.cid = fc.cid INNER JOIN filedepot_access AS fa ON fc.cid = fa.catid WHERE fa.permid=$id AND fname LIKE '%$key%' ORDER BY DATE </code></pre> <p>The environment is a PHP script running under Drupal with FileDepot module but I doubt that matters at all.</p> <p>This is the PHP script (well the part that matters):</p> <pre><code>$id = 1; $key = $_GET['key']; $query = .... (see above) $result = db_query($query); while($row = db_fetch_array($result)){ //do stuff echo $row['fname']; } </code></pre> <p><code>db_query()</code> is a Drupal method that allows to easily execute SQL queries and a returns an array, <code>db_fetch_array()</code> allows to parse the result.</p> <p>Now, DB contains the following entries for fname (there are more, these are just examples):</p> <ul> <li>Dichiarazione 1</li> <li>Dichiarazione 2</li> <li>Guida 1</li> <li>Guida 2</li> </ul> <p>If I launch the script with "guida" as key it correctly returns the two entries both with PHP and MySQL. If i use "Guida" it works as well. However if I use "dichiarazione" it doesnt with PHP while it does with MySQL. Strange thing is that "Dichiarazione" works both with PHP and MySQL.</p> <p>What is wrong with the query? I tryed to use <code>LOWER(fname) LIKE '%$key%'</code> but it doesn't seem to work as intended.</p> <p>I am sure there is something stupid that I am missing but I can't seem to find what that is...</p>