I hope this is the right place to post - I have a problem with mSQL
which I'm sure is just due to something silly which as someone new to
mSQL I have just missed out.

I'm trying to write a program, as below, which takes info from a form
and checks a table to see if the userid has been created before.

The program runs through ok and prints out the HTML at the end, but
when I re-run the program it does exactly the same - though it should
show a different page (the else info that is missing from the below)
as the user has already been entered into the dbase.

Help!

PK

#!/usr/bin/perl

use strict;
use CGI;
use Msql;

my $qr = new CGI;
my $qo = new CGI;
$qr->import_names( "res" );

my $usertemp = $res::userid;
my $db = Msql->connect;

$db->selectdb('emcdbase');
my $sq = "SELECT userid FROM personaldata WHERE userid = $res::userid
";
my $output = $db->query($sq);
my @values = $output->fetchrow;

if ($values[0] ne $usertemp)
{

my $outputed = $db->query("INSERT INTO personaldata (userid, fname,
sname, address1, address2, town, county, pcode, country, phone) VALUES
( $res::userid, $res::fname, $res::sname, $res::address1,
$res::address2, $res::town, $res::town, $res::county, $res: code,
$res::country, $res: hone");

my $created = $db->query("SELECT userid FROM personaldata WHERE userid
= $usertemp ");
my $person = $created->as_string;

print <<END_OF_MESSAGE;
Content-type: text/html

# Rest of HTML deleted