I have the following line of code :
mysql_query("SELECT name FROM details WHERE md5(name) = '".md5($input_name)."'");
This query works just fine , however , when i change the query to the following :
mysql_query("SELECT name FROM details WHERE salt(name) = '".salt($input_name)."'");
The query doesn’t seem to work.
The salt function is as follows :
function salt ($name) {
global $salt;
return $salt.$name;
}
where $salt is a global variable ( an md5 hash)
Why doesn’t the second query work ?
MySQL has no access to functions you define in PHP. You can only use functions that MySQL defines in a MySQL query, or functions that you have written in SQL. You’ll have to rethink what you’re doing and express it in a way that does not require MySQL to use PHP functions.