Valen wrote:
> I play Ruby without rails:
> 
> <% @connection = Mysql.new('localhost', 'root', '', 'carpart')%>
> <%=  query = 'Select * from `store` where  `part`="Stuff on shelf" ' %>
> <% list = @connection.query(query) %>
> 
>  and it works, but when I try to use a="Stuff on shelf" and I have
> 
> <%=  query = 'Select * from `store` where  `part`=' +  "#{a}"  %>
> 
>  operator <% list = @connection.query(query) %> raises MYSQL error, so I 
> cannot change string "Stuff on shelf" by variable a. I tried different 
> ways, but in vain.
As you have it there, is supect the resulting query is being generated
as:
'Select * from `store` where  `part`=Stuff on shelf'

I suspect you need to have quotes around 'Stuff on shelf', maybe try

<%=  query = 'Select * from `store` where  `part`="' +  "#{a}\""  %>


> 
> And the second question: How to insert in *.rhtml file another *.rhtml 
> file by using ruby operator insert or other?

you can load a ruby file via require (only loads once) or load (loads
file every time).  Not sure if it will work with eruby...

cheers

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