vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Having trouble evaluating some PHP code... (https://vborg.vbsupport.ru/showthread.php?t=239381)

Jaxel 03-30-2010 12:35 AM

Having trouble evaluating some PHP code...
 
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:
Code:

$title = $service['svcTitle'];
echo $title;

Quote:

$arr['media:group']['media:title']['value']

But if I use this code instead, it will output the following instead:
Code:

$title = $arr['media:group']['media:title']['value'];
echo $title;

Quote:

This is the title

I'm trying to use the following, but I am getting an error instead:
Code:

$title = $service['svcTitle'];
eval("\$title = \"$title\";");
echo $title;

Quote:

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?


All times are GMT. The time now is 06:37 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01046 seconds
  • Memory Usage 1,712KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (1)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete