Re: [PHP-DB] variable and MySQL

2005-03-16 Thread Mark Cain
I think I understand your question.  Perhaps what you want is not a variable
variable -- but a variable (determined from the context).
Variables always vary depending on the situation as opposed to a constant
which - uhh -- stays constant.  Combine the variable and the constant in a
new variable first with concatenation.

$question_pointer = $xxx . _name_en;

$get_question_data[$question_pointer]

Mark Cain


- Original Message -
From: simon [EMAIL PROTECTED]
To: php-db@lists.php.net
Sent: Monday, March 14, 2005 7:14 PM
Subject: [PHP-DB] variable and MySQL


 Hi, I'm trying to make a script but have a problem ...

 How could I do this:

 I'd like to use   $get_question_data[xxx_name_en]

 where xxx would be a variable variable according to the situation where
the
 script is called... how would I do this?

 tried :

 $get_question_data[$test_name_en]
 $get_question_data[{$test}_name_en]
 ${get_question_data[$test_name_en]}

 but nothing works  any help would be appreciated.

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] variable and MySQL

2005-03-16 Thread Sam Street
Mark Cain wrote:
I think I understand your question.  Perhaps what you want is not a variable
variable -- but a variable (determined from the context).
Variables always vary depending on the situation as opposed to a constant
which - uhh -- stays constant.  Combine the variable and the constant in a
new variable first with concatenation.
$question_pointer = $xxx . _name_en;
$get_question_data[$question_pointer]
Mark Cain
- Original Message -
From: simon [EMAIL PROTECTED]
To: php-db@lists.php.net
Sent: Monday, March 14, 2005 7:14 PM
Subject: [PHP-DB] variable and MySQL
 

Hi, I'm trying to make a script but have a problem ...
How could I do this:
I'd like to use   $get_question_data[xxx_name_en]
where xxx would be a variable variable according to the situation where
   

the
 

script is called... how would I do this?
tried :
$get_question_data[$test_name_en]
$get_question_data[{$test}_name_en]
${get_question_data[$test_name_en]}
but nothing works  any help would be appreciated.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
   

 

$var = 'heh';
$get_question_data[{$$var}_name_en];
Hopefully that would parse to $get_question_data[$heh_name_eh]
/guess
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] variable and MySQL

2005-03-15 Thread Ross Honniball
Not entirely sure what you are wanting, but if you want a variable 
variable, just use a double $ sign. eg:

$fred = 'var2';
$var2 = 'value of var 2';
echo $$fred;
will echo 'value of var 2'
At 10:14 AM 15/03/2005, you wrote:
Hi, I'm trying to make a script but have a problem ...
How could I do this:
I'd like to use   $get_question_data[xxx_name_en]
where xxx would be a variable variable according to the situation where the
script is called... how would I do this?
tried :
$get_question_data[$test_name_en]
$get_question_data[{$test}_name_en]
${get_question_data[$test_name_en]}
but nothing works  any help would be appreciated.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

. Ross Honniball  JCU Bookshop Cairns Supervisor
. James Cook Uni, McGregor Rd, Smithfield, Qld. 4878,  Australia
. Ph:07.4042.1157  Fx:07.4042.1158   Em:[EMAIL PROTECTED]
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php