database retrieve problem

NavaTux <>
Sun Mar 28 19:33:11 CEST 2010


ya..it displayes in shell,when i wanna to display in my web page i
used to give wf:flash([Results]) it throws the error below,

event(continue) ->
  	[Name] = wf:q(no_id),
  	Message = wf:f("The Result is~p", [Name]),
	ConnString = "DSN=mysqldb",
	{ok, Conn} = odbc:connect(ConnString, []),
  	{selected, _Cols, [Results]} = odbc:sql_query(Conn, "SELECT * FROM
marks where id=1"),
  	io:format("~p",[Results]),
  	wf:flash([Results]),
  ok;


()15> {1,45,55,67,89}CAUGHT ERROR: error-
{badrecord,elementbase}
[{wf_render,render,1},
 {wf_render,'-render/1-lc$^0/1-0-',1},
 {element_panel,render,2},
 {wf_render,render,1},
 {wf_render,'-render/1-lc$^0/1-0-',1},
 {wf_render,'-render/1-lc$^0/1-0-',1},
 {element_panel,render,2},
 {wf_render,render,1}]

Here let me know what happened?


On Mar 28, 9:58 pm, Hynek Vychodil <> wrote:
> When I look at your error message and code then I easily can guess,
> that badmatch is on row
>
> [Results] = odbc:sql_query(Conn, "SELECT * FROM marks where id=1")
>
> so I look at documentation and bingo! It is. I strongly recommend you
> try code in shell and look what code returns when you don't want read
> documentation. You should try it in shell even have read
> documentation. Above row should be
>
> {selected, _Cols, [Result]} = odbc:sql_query(Conn, "SELECT * FROM
> marks where id=1")
>
> or
>
> {selected, _Cols, Results} = odbc:sql_query(Conn, "SELECT * FROM marks
> where id=1")
>
>
>
> On Sun, Mar 28, 2010 at 9:37 AM, NavaTux <> wrote:
> > I wanna to use the query to retrieve some results from the database,so
> > i used these lines
>
> > event(continue) ->
> >        [Name] = wf:q(no_id),
> >        Message = wf:f("The Result is~p", [Name]),
> >        ConnString = "DSN=mysqldb",
> >        {ok, Conn} = odbc:connect(ConnString, []),
> >        [Results] = odbc:sql_query(Conn, "SELECT * FROM marks where id=1"),
> >        io:format("~p",[Results]),
> >        wf:flash([Results]),
> >  ok;
> > event(_) -> ok.
>
> > but i am unable to get the output,Here continue is the postback for
> > button,here what goes wrong?
>
> > I am getting output in my terminal is
>
> > =INFO REPORT==== 28-Mar-2010::21:56:22 ===
> > ERROR: error
> > {badmatch,{selected,["id","tamil","english","maths","science"],
> >                    [{1,45,55,67,89}]}}
> > [{web_index,event,1},
> >  {wf_handle_postback,run_module_event,2},
> >  {wf_handle_postback,handle_normal_request,3},
> >  {wf_inets,do,3},
> >  {httpd_response,traverse_modules,2},
> >  {httpd_response,generate_and_send_response,1},
> >  {httpd_request_handler,handle_response,1},
> >  {gen_server,handle_msg,5}]
>
> > id,tamil,english,maths,science are database fields....
>
> > please help me
> > as well as i wanna know how to flash the output that i retrieved from
> > the database in my webpage..
>
> > ________________________________________________________________
> > erlang-questions (at) erlang.org mailing list.
> > Seehttp://www.erlang.org/faq.html
> > To unsubscribe; mailto:
>
> --
> --Hynek (Pichi) Vychodil
>
> Analyze your data in minutes. Share your insights instantly. Thrill
> your boss.  Be a data hero!
> Try GoodData now for free:www.gooddata.com
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> Seehttp://www.erlang.org/faq.html
> To unsubscribe; mailto:


More information about the erlang-questions mailing list