Forum: Ruby passing html params in Ruby

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
joep (Guest)
on 2007-02-09 20:21
(Received via mailing list)
I have an AJAX page that I built.
The user enters in some info.
I format a query string and want use it to query my DB.

something like this:

var query_string = "SELECT * FROM mydbtable;

require 'dbi'
require 'cgi'
cgi =
params = cgi.params

new_query_string = cgi.params['query_string']

dbh =

newsth = dbh.execute("#{new_query_string}")

rows = newsth.fetch_all


the query_string variable is not passed in the 'params', so obviously
this code is never going to work.
How do I pass the formatted variable (query_string) into my embedded
ruby code so that I can query my DB?

Thank you in advance.
This topic is locked and can not be replied to.