###### # Connecting to our database ###### my $dbh = DBI->connect("DBI:mysql:$dbase", $mysql_user, $mysql_pass) or print DBI=>"errstr"; my $url = url_param("url"); ###### # Was the referring URL in the database? or not ###### my $data = qq(SELECT id, views, last_ip, last_time, all_ip FROM track where id = "$url"); my $sth = $dbh->prepare($data); $sth->execute() or die $dbh->errstr; if ($sth->rows < 1) { my ($id, $views, $last_ip, $last_time, $all_ip); $sth->bind_columns(\$id, \$views, \$last_ip, \$last_time, \$all_ip); # nothing was here so we'll setup the values starting with 1 view } else { my ($id, $views, $last_ip, $last_time, $all_ip); $sth->bind_columns(\$id, \$views, \$last_ip, \$last_time, \$all_ip); # this URL was tracked previously, we have to autoincrement $views and store all our info }