#!/usr/bin/perl
use strict;
use DBI;
use CGI ":all";
use lib qw(/usr/local/modules/);
use birds;
use CGI::Carp qw(fatalsToBrowser warningsToBrowser);
# params
my ($bird) = param('bird');
my ($dothis) = param('dothis');
if (!$dothis) {
$dothis = 1;
}
# html
my ($spaces) = " ";
# start
my ($nospace) = "";
if (!$bird) {
$dothis = 0;
}
my ($id) = &birds::lookup("species","id","nospace_name","$bird");
my ($code) = &birds::lookup("species","species_code","id","$id");
my ($uc_code) = uc $code;
my ($lc_code) = lc $code;
my ($dbh) = &birds::connect_to_db;
my ($cur,$cur2,$timestamp) = "";
print header,start_html(-title=>"$uc_code Conte Survey Species Account");
print "
\n";
if ($dothis == 0) {
print "some error";
}
if ($dothis == 1) {
&make_buttons;
my ($dbh) = &birds::connect_to_db;
my ($temp) = "";
my ($sampsize,$intro,$obsv,$uc_name) = "";
my ($graph_hp) = "_HP.gif";
my ($graph_sp) = "_SP.gif";
my ($graph_sh) = "_SH.gif";
my ($graph_page_suffix) = "_graphs.html";
my ($graph_link) = "$lc_code$graph_page_suffix";
$cur = $dbh->prepare("SELECT common_name,latin_name,nospace_name FROM species WHERE id=$id");
$cur->execute;
$DBI::err and die "Prepare/Execute error: $DBI::err .... $DBI::errstr";
while (my($name,$latin,$nospace) = $cur->fetchrow_array) {
$sampsize = &birds::lookup("species_data","sample_size","species_id","$id");
$intro = &birds::lookup("species_data","intro_text","species_id","$id");
$obsv = &birds::lookup("species_data","obsv_text","species_id","$id");
$uc_name = uc $name;
print "\n\n";
print "\n \n\n";
print "
$uc_name ($latin) $uc_code $spaces Sample size: $sampsize |
|
|
$intro
Graphs |
|
Observations
$obsv
|
|
|
|
\n";
print "
| \n\n";
}
}
print " |
\n";
$dbh->disconnect;
# subs
sub make_buttons {
# make the nav table
print "\n
\n\n |
\n";
} # end make_buttons
# reference
#
#mysql> desc species;
#+--------------+--------------+------+-----+---------+----------------+
#| Field | Type | Null | Key | Default | Extra |
#+--------------+--------------+------+-----+---------+----------------+
#| id | int(11) | NO | PRI | NULL | auto_increment |
#| common_name | varchar(128) | YES | | NULL | |
#| nospace_name | varchar(64) | YES | | NULL | |
#| latin_name | varchar(128) | YES | | NULL | |
#| sort_int | int(11) | YES | | 0 | |
#| species_code | varchar(8) | YES | | NULL | |
#| image_c | varchar(32) | YES | | NULL | |
#| acct_file | varchar(128) | YES | | NULL | |
#| graph_file | varchar(128) | YES | | NULL | |
#| last_update | datetime | YES | | NULL | |
#+--------------+--------------+------+-----+---------+----------------+
#10 rows in set (0.03 sec)
# revisions
# 2/25/2015 - Suzanne - program created