I'm trying to do something that i'm not sure is even possible.  I want
to cycle thru an array of MySQL fieldnames and dynamically declare
variables based on those fieldnames. 

I can create the array of fieldnames no problem, by just using
"describe" with DBI.

But I can't figure out the declaration part.  THis is what i've tried...

foreach $i (@fieldlist) {
        $$i = $session->get_query_value('$i');
        }

That doesn't work, although that's the gist of what I'm after. 
Fieldnames are like "order_id", bill_fname", "ship_lname", etc.  

If I were to hard-code these declarations, I would have about 40 lines
that look like:

$order_id = $session->get_query_value('order_id');
$customer_id = $session->get_query_value('customer_id');
$bill_prefix  = $session->get_query_value('bill_prefix');
$bill_fname = $session->get_query_value('bill_fname');

The $session-> bit is a function that grabs data of the same name as my
fieldnames from an outside sessionfile.

I am just trying to avoid having to hardcode this stuff in there,
because a) it's alot of code and b) the fieldnames/session variables
will grow and I don't want to have to edit the script every time.  

Any help is appreciated!

Thanks,

rory



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to