in reply to MySQL/DBI: Error if entry is not in the database
#print "Content-type:text/html\n\n";
to print the body tags and any CCS, Javascripts and stuff, use the start_html clause:print header();
print start_html(-bgcolor=>"#FFFFFF", -text=>"#000000", -style=>{code=>$somecode}, -script=>{code=>$Somejscript});
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. }
$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.
$dbh = SOMEDIR::SOMENAME::Connect();
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
|
|---|