I have a mysql db where I have
I want the content of action to be evaluated so that the variable $xvar will be set to "John"... how do I do this?
use the eval function. You'll want to escape the "$" and add a line ending though...
eval("\".$result['action'].";"); echo $xvar;
if that don't work, try storing your string like this: \$xvar="text";
I should add that the use of eval will slow your page times.
Eval can be very handy, but should used sparingly and only where absolutely necessary. A few evals per page wont hurt that much though.