how can i print an individual field when using the simple perl database sample

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • linly
    New Member
    • Jan 2012
    • 1

    #1

    how can i print an individual field when using the simple perl database sample

    Using the Simple perl database in Bytes, I have defined my database as follows:
    Code:
    %fields = (
    	ID 				=>		[0,		'Link ID:',				'text'],
    	UserName	=>		[1,		'UserName:',			'text'],
    	Password 	=>		[2,		'Password:',			'text'],
    	Level 		=>		[3,		'Level:',					'drop'],
    	FullName	=>		[4,		'Full Name:',			'text'],
    	Email			=>		[5,		'Email Address',	'text'],
    	Location	=>		[6,		'Location',				'text'],
    	);
    I am using check boxes to choose who I will send an email too, and I want to use the email address, but after 10 hours of trying all what I can think of, I'm still stuck. This is probably a simple question, but its got me stumped.
  • RonB
    Recognized Expert Contributor
    • Jun 2009
    • 589

    #2
    As written that hash would only hold the info for 1 user. You need to use a hash-of-hashes or an array-of-hashes.

    Here's how to access the email address in the hash you posted.
    Code:
    print $fields{'Email'}[1];

    Comment

    Working...