Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > passing html params in Ruby

Reply
Thread Tools

passing html params in Ruby

 
 
joep
Guest
Posts: n/a
 
      02-09-2007
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 = CGI.new
params = cgi.params

new_query_string = cgi.params['query_string']

dbh =
DBI.connect("dbig:dbname=blank;host=blank;port=b lank","blank","blank")

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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LFSR calcs, passing params. Niv (KP) C Programming 3 05-16-2009 08:58 AM
FormView's ODS not passing correct insert params to BLL. How to debug this? bogdan ASP .Net 0 04-10-2008 12:23 PM
params v.s. @params in rails? Barry Ruby 9 09-15-2005 03:12 AM
passing params to html-form Holger Butschek Javascript 1 09-11-2004 10:04 PM
passing multi params Paul Vudmaska Ruby 2 04-21-2004 09:21 PM



Advertisments