Variable Question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am trying to assign variables from an array into variables.  This is following a database query.  Right now they are in an array:

$row[‘word_1’]
$row[‘word_2’]
$row[‘word_3’]
...
$row[‘word_25’]

I am trying to use this while look to assign them to variables:
$word_1
$word_2
$word_3
...
$word_25

This is the WHILE loop:

$i = 1;
while ( $i <= 25 ) {

    ${'word_'.$i} = stripslashes( eval ("echo $row['word_$i']") );

++$i;
}

What is confusing me is I don’t know how to represent the array variable.

The specific error message I am receiving is:

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING

Can anyone see what I have done wrong and help me correct it?  Thank you.  Ron


Ron Piggott



www.TheVerseOfTheDay.info 

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux