Forum: Ruby html parameters 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.
199b6c213f0ac380d3f794028bbbb286?d=identicon&s=25 joep (Guest)
on 2007-01-30 18:15
(Received via mailing list)
I want to allow the user to 'filter' his query on a DB.

So, I allow them to select checked boxes for the infor they want. I
then format a string and pass it to a function. My function looks like

function refreshScrollList(strQuery)


alert("HERE IS THE QUERY STRING " + strQuery);      <--everything
looks right here

require "dbi"
require 'cgi'
cgi =

# Require the CGI library

# prepare trap for form variables
# there is an artifact space sent from an empty form field so to
verify the field values have to be
# Stripped of whitespace and carriage returns (strip) so (empty) will
work properly.
username = cgi['username'].strip
profession = cgi['profession'].strip

dbh =
# get server version string and display it
row = dbh.select_one("SELECT VERSION()")
#puts "Server version" " + row[0]);

#newsth = dbh.execute(strQuery);           <-----This is the line I
want to use.

the next line is the hard coded value that I have working right now

newsth = dbh.execute("SELECT id, condition  FROM products WHERE
beginyear>'1990' LIMIT 100;")

rows = newsth.fetch_all

Array_Header = <%=newsth.column_names.inspect%>;
Array_Body = <%=rows.inspect%>;



This is probably a simple task. Thanks in advance!
This topic is locked and can not be replied to.