I'm trying to pass a php variable name to mysql and then retrieve the variable name back where it displays the appropriate value.
UPDATE: APOLOGIES: As each page will have a different VARIABLEVALUE as called by MySql. ::UPDATE ENDED::
Currently I'm using mysqli, with varchar, but should I be using text? or is this irrelevant.
Data stored in contentData on mysql is as such:
$variableName = VARIABLEVALUE;
So SQL dataRow is:
Some data and information $variableName some data and information
php code i am trying to use to retieve the text and variable is:
$variable = $row_mysqlresult['contentData'];
I'm calling the data as above, but also re-indexing to:
$variable = '. $variable .';
echo = $variable ;
This now displays
Some data and information $variableName some data and information
Instead of
Some data and information VARIABLEVALUE some data and information
I think I've just overcomplicated what I'm trying to do...
Any help, much appreciated :))
echo = $variable ;is no valid syntax.$variable = '. $variable .';just makes a string whose contents are " $variable " (i.e a space, a $, the word "variable" and another space). Variable names in single-quoted strings in PHP aren't transformed into the variable value. If you want to add spaces either side of the string you need double-quotes here. I'm also guessing the.s aren't really what you wanted? So try:$variable = " $variable ";