Jump to content

Display an array value using a variable?


dabigchz

Recommended Posts

Ive never encountered this before and I have no idea how to go about it. Hopefully someone can help me.

 

Basically, I have get the variable $viewid, and I want to get the variable from my MySQL table that has the same name as $viewid

 

$viewid = "view" . $_SESSION['id'];

//All the MySQL junk that doesnt matter

$ident = "$row2['" . $viewid . "']"
echo $ident;

 

That just comes up with "Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING"

 

Any help would be greatly appreciated.

Link to comment
https://forums.phpfreaks.com/topic/119705-display-an-array-value-using-a-variable/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.