Been searching here and google for over an hour, can't seem to find the answer to this.
I have a string returned from a database query which contains variables, however it appears that these strings are all returned single-quoted and therefore the variables are not evaluated as they would be if it was double quoted.
what is returned from the sql query would be the $result:
This will not evaluate the 2 variables:
$myname = 'david';
$occupation = 'Beginner';
$result = 'Hello my name is $myname and I my occupation is $occupation';
echo $result;
This will evaluate the 2 variables:
$myname = 'david';
$occupation = 'Beginner';
$result = "Hello my name is $myname and I my occupation is $occupation";
echo $result;
My question is how do I convert a single-quoted string to a double-quoted string which is able to evaluate the variables ??
Thanks