Maybe the question title isn't very clear but I don't know how to describe.
I'll try to explain:
I have a MySQL query in my PHP code like this:
$statement = $pdo->prepare('SELECT name FROM persons WHERE name = :name');
$statement->execute(array(':name' => "Peter-Loew"));
What I want to to is to edit :name
before comparing with "Peter-Loew"
.
I want to run a PHP code like this on :name
before comparing with "Peter-Loew"
:
<?php
function url_replace($url_replace) {
$url_replace = str_ireplace(array('Ä','Ö','Ü'), array('Ae','Oe','Ue'), $url_replace);
$url_replace = preg_replace('~[^a-zA-Z0-9]+~', '-', $url_replace);
$url_replace = trim($url_replace, '-');
$url_replace = rtrim($url_replace, '-');
return $url_replace;
}
?>
How can I do this? Or, does anybody know how to call this what I'm looking for?