Jump to content

Recommended Posts

Hi, just a quick question, what i am trying to do is basically this:

 

<td class="cell" align="center" height="19">'.$row["$_SESSION['name']"].'</td>

 

I.e. Placing the session variable within the row variable to obtain the result, however i as yet cannot get it to work, i assume its some clever combination of quotes and single quotes to achieve the correct syntax but i have yet to find it.

 

Help would be much appreciated.

I thought you were talking about a variable variable.

 

Ex:

 

$bar = "Hello";
$foo = "bar";

echo($$foo); // will display Hello

 

What you are dealing with is simple array keys, and yes that is one way to do it as Ken2k7 stated.

 

if you are using echo() to list the entire td element you can also do it this way:

 


echo('<td class="cell" align="center" height="19">'.$row[$_SESSION['name']].'</td>');

 

same difference.

 

if you are using echo() to list the entire td element you can also do it this way:

 


echo('<td class="cell" align="center" height="19">'.$row[$_SESSION['name']].'</td>');

 

same difference.

 

Not really. The method you posted, since concatenation is being used, will be faster/more efficient by microseconds. :)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.