mysql - PHP SQL query how to have ' in variables -
this going simple question head spinning.
i using php in web service. 1 item receive string save sql database.
issue strings must able contain ' when build query following
$query = "insert table (column1) values ('{$_post('string')}')";
it throws sql query error if ' used.
any solutions
thanks
you need escape strings insert database.
mysqli resource: http://php.net/manual/en/mysqli.real-escape-string.php
pdo resource: real escape string , pdo
mysql
No comments:
Post a Comment