is there any built-in way or method available to implement mysqli_real_escape_string
method. I have some custom data on which I have to implement this method.
I tried this \DB::escape()
method in laravel but got following error.
ErrorException in DatabaseManager.php line 296: call_user_func_array()
expects parameter 1 to be a valid callback, class 'Illuminate\Database\MySqlConnection' does not have a method 'escape'
while If I try manually implement this method mysqli_real_escape_string
got following error.
ErrorException in Contact.php line 348: mysqli_real_escape_string() expects exactly 2 parameters, 1 given
I did some R&D, for this method mysqli_real_escape_string()
I have to pass 2 parameter 1 is DB connection link, and 2nd is string to implement method action. but now, How I will know Laravel DB connection link?
any idea or solution for this ?
Laravel uses PDO, so there's no escaping, just prepared statements. See the Laravel manual on databases.
If you absolutely need this type of feature, you could try DB::connection()->getPdo()->quote()
instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With