Can I put a variable within the []

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
3dron
Forum Commoner
Posts: 40
Joined: Sat Feb 01, 2003 10:25 pm

Can I put a variable within the []

Post by 3dron »

I am trying to echo the value under a column set by the pick number in another database.

$entry = pick.$row_Vote['pick1'];
Now if I echo $entry I get let's say 'pick2'

Now how can I put $entry in the statement below, where is says variable here?

echo $row_RecordName['variable_here'];

O amtrying to store only number values of a players picks. Then later cross reference the numbers with the names for each category.
User avatar
Stoker
Forum Regular
Posts: 782
Joined: Thu Jan 23, 2003 9:45 pm
Location: SWNY
Contact:

Post by Stoker »

Quotes generates strings, put the string in a variable and you can use that instead...


echo $arrayvar['beer']

is the same as

$mystringvar = 'beer';
echo $arrayvar[$mystringvar];
Post Reply