I am trying to modify some code and I wanted to use mysqli instead of mysql if possible. Here is what it looks like today.
$query = sprintf("select * from table where column = '%s';",mysql_escape_string($value));
$result = do_query_mysqli($query, __FILE__, __LINE__);
the function do_query_mysqli is in another file and I don't want to modify that file if possible. That function also includes $link to connect to the DB.
I do not have access to $link in the file I am modifying.
What is the best alternative to the code below if I want to achieve a similar result but I don't have access to $link?
$value = mysqli_real_escape_string($link, $value);
Thanks!
Edit -- None of the answers and comments address my issue which is I am trying to reduce the risk of sql injection without having to change the function that executes the queries. But I will look into the solutions suggested anyway. Thanks.