PDA

View Full Version : Having trouble evaluating some PHP code...


Jaxel
03-30-2010, 12:35 AM
Okay, lets say I have a database table row result called "$service", inside of this row, there is a column called "svcTitle".
Right now the contents of $service['svcTitle'] is "$arr['media:group']['media:title']['value']".
This is an XML request, and it returns the title in a YouTube video... which is "This is the title"

The code below will output the following result:
$title = $service['svcTitle'];
echo $title;
$arr['media:group']['media:title']['value']


But if I use this code instead, it will output the following instead:
$title = $arr['media:group']['media:title']['value'];
echo $title;
This is the title


I'm trying to use the following, but I am getting an error instead:
$title = $service['svcTitle'];
eval("\$title = \"$title\";");
echo $title;
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/eightway/public_test/media/media_submit.php(48) : eval()'d code on line 1
$arr['media:group']['media:title']['value']


What am I doing wrong?