How to insert a string in PHP and MySQL

dbms_assert.enquote_literalused for single string quotes in Oracle. Is there a similar function in MySQL and PHP?

+4
source share
1 answer

You can use a custom function to do this.

Example:

function str_enq($string = '')
{
    $char = '\'';
    return str_pad($string, strlen($string) + 2, $char, STR_PAD_BOTH);
}
0
source

Source: https://habr.com/ru/post/1618772/


All Articles