#print "Content-type:text/html\n\n";

Why did you comment out the content type?

since your using CGI.pm's :standard the easier way to print the headers is like this:
print header();
to print the body tags and any CCS, Javascripts and stuff, use the start_html clause:
print start_html(-bgcolor=>"#FFFFFF", -text=>"#000000", -style=>{code=>$somecode}, -script=>{code=>$Somejscript});


And how I test for rows is like this:

my ($sth, $row); $dbh = <useyourconnection>; $sth = $dbh->prepare (qq{ SELECT * FROM mytable }); $sth->execute(); while ($row = $sth->fetchrow_hashref()) { # these are the rows that do exists do # what you want with those rows. }

If you only want to check for ONE record you can do it like this:

$sth = $dbh->prepare (qq{ SELECT * FROM mytable WHERE some_column += ? }); # The ? is a placeholder $sth->execute($str); # $str is what your searching for $row = $sth->fetchrow_hashref(); # This executes the above $sth->finish();# This closes the connection.

That is untested, so please take it with a grain of salt.

I actually store everything in a LOCAL module I create. I have the script push the location to @inc then just use the module. Then my connections look more like this (EVER TIME):
$dbh = SOMEDIR::SOMENAME::Connect();

That way I don't have to re-write the whole dang code every single time. I just use that statement and it's much faster.

Just because I showed you that, does not mean you don't need to show more of your code to get a better answer. I'm just showing you how I do it, PLUS if you leave the print Content-type commented out, you'll get a error in your browser every time. The error logs for that should say premature end of script headers.

Hope that helps some.
Richard.

UPDATE:
Sorry, I did not NOTICE the part that you commented out the print Content-type because you ALREADY used CGI.pms functions which I recommended. My bad. Please disregard that part.

Thanks!

Added update per author request - dvergin 2003-01-23


In reply to Re: MySQL/DBI: Error if entry is not in the database by powerhouse
in thread MySQL/DBI: Error if entry is not in the database by basm101

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.