Help for this page

Select Code to Download


  1. or download this
    # Table name: levels
    level_id    level_name
    ...
    2           Secondary Two
    3           Secondary Three
    4           Secndary Four
    
  2. or download this
    # Table name: profiles
    member_id
    ...
    .
    .
    joined
    
  3. or download this
    my $sql = qq{ SELECT * FROM profiles, levels
      WHERE member_id=23
    ...
    $sth->execute();
    my $hashref = $sth->fetchrow_hashref();
    # So level name is stored in $hashref->{level_name}
    
  4. or download this
    # In a separate file from the main script
    our %levels = (
    ...
      3 => Secondary Three,
      4 => Secndary Four
    );
    
  5. or download this
    my $sql = qq{ SELECT * FROM profiles, levels WHERE member_id=23 };
    my $sth = $dbh->prepare($sql);
    $sth->execute();
    my $hashref = $sth->fetchrow_hashref();
    So level name can be retrived via $levels{$hashref->{level_id}}