I am having a problem with php variables that are stored in a mysql table. If I have
Then I have no problems with the $var being replaced with its value but if I pull that same text from my mysql database the output is "This is some text ' . $var" i.e. the $var is printing as text and not being replaced.
I have tried several variants of having quotes (both double and single) in the mysql table, I have also tried escaping the quotes and even type casting the $text variable when it is extracted from the table.
My guess is that it is probably something to do with the implied quotes on the string data from mysql.
I know I am missing something obvious here but I cannot see what it is.
David
Remember: You only know what you know
and - you don't know what you don't know!
Code:
$text = 'This is some text ' . $var;
echo $text;
I have tried several variants of having quotes (both double and single) in the mysql table, I have also tried escaping the quotes and even type casting the $text variable when it is extracted from the table.
My guess is that it is probably something to do with the implied quotes on the string data from mysql.
I know I am missing something obvious here but I cannot see what it is.
David
Remember: You only know what you know
and - you don't know what you don't know!