[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

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

Gale Cho

7/4/2007 10:56:00 AM

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

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

2 Answers

Gale Cho

7/5/2007 10:08:00 PM

0

Any idea how to fix this, folks ?

Gale

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

John Joyce

7/6/2007 1:40:00 AM

0


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

> 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
>
> --
> Posted via http://www.ruby-....
>
move the cgi out statement below the require cgi statement