CGI with DBI error - cant use both at the same time

Hi,

I’m using Ruby’s CGI to handle some forms, and the form input is to be
further used to query a database. But I’m getting errors when I try to
use the DBI module to connect to the database. Even just typing
“require ‘dbi’” is screwing up things. For instance in the following
code, nothing would show up unless I remove “require ‘dbi’”.

#!/usr/local/bin/ruby -w
print “Content-type: text/plain\n\n”
require “cgi”
require “dbi”

puts “Thanks- form submitted”

If instead of using the print command, I try to use cgi.out then I get
“500 Internal Server Error”. Does anyone know a fix to this problem ?

Thanks,
Gale

Any idea how to fix this, folks ?

Gale

On Jul 4, 2007, at 5:55 AM, Gale CC wrote:

require “cgi”

Posted via http://www.ruby-forum.com/.

move the cgi out statement below the require cgi statement