I am storing text in my database.
Here is the following text:
".$teamName.", is the name of a recently formed company hoping to take over the lucrative hairdryer design ".$sector."
After querying the database I assign this text to a variable called $news, then echo it.
However the text is outputted to the screen exactly as above without the variables $teamName*and $sector replaced by there corresponding values.
I assure you that both $teamName and $sector are defined before I query the database.
Is it even possible to do what I am trying to do?
You might be better off using
sprintf()here.In your database, you store
$string. Usesprintf()to substitute the variable values.