Pretty much I have a function that converts a string to a URL friendly string.
Example: $string = "Hello World!"
, when passed through my function, it would read url($string) = "hello-world"
So what I want to do is find in my database where the row = "hello-world" But my databases aren't formatted like that so I want to pretty use my function is the sql query.
Example:
$sql = "SELECT * FROM table WHERE url(row) = 'hello-world'";
I don't know if this is possible or not. I know I could get the results use the function and then pass it though the database again. But I was hoping there was a simpler way.
By the way I am using MySQLi Procedural if it makes a difference.
You can use your function within the query string itself like this, it allows the function to be used like a string and prints in the "field" you type in, then your function can escape the characters and presets, then returns the string.
$sql = "SELECT * FROM table WHERE ".url("field")." = 'hello-world'";