PHP curly braces in database
so i have a problem. We have several values ββin our database, which are stored as follows:
{yoyoyo}
This is great until we pull the value out of the database using PHP. It seems to crash PHP when trying to access a variable like this:
$result['curly'];
For some reason PHP interprets this as its variable.
Does anyone know how to escape the result from the DB, so PHP interprets it as a string and not a variable?
Thank!
+3
source to share
2 answers
You can use htmlentities - http://php.net/manual/en/function.htmlentities.php
This will convert all characters to html objects. You can also store things in the future that shouldn't be used as variables for html objects before putting them into the database to avoid this problem.
+2
source to share