database retrieve problem

NavaTux navaneethanit@REDACTED
Sun Mar 28 21:15:19 CEST 2010


may i know what i need use instead of using [Results] variable,

(nitrogen@REDACTED)28> {1,45,55,67,89}                 //whole row
displaying

yes if i use the variable [Results] meant i am getting the full
row,but i wanna display a field by field for that what i have to
declare

please explain friend

let me know how to fetch the results from shell to my webpage

On Mar 28, 11:53 pm, Hynek Vychodil <hy...@REDACTED> wrote:
> There is raised {badrecord,elementbase} exception in
> wf_render:render/1 function. Just guess, should not event/1 return
> some record? wf:flash/1 parameter should be some sort of record?
> Something other expecting record where wf:flash/1 parameter is passed
> to? I don't know, look at documentation and if it doesn't there, blame
> author.
>
> I'm just curious, why you consistently write [Results] when there one
> result row will be binded to Results variable?
>
>
>
> On Sun, Mar 28, 2010 at 10:33 AM, NavaTux <navaneetha...@REDACTED> wrote:
> > 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;
>
> > (nitrogen@REDACTED)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 <hy...@REDACTED> 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 <navaneetha...@REDACTED> 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:erlang-questions-unsubscr...@REDACTED
>
> >> --
> >> --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:erlang-questions-unsubscr...@REDACTED
>
> > ________________________________________________________________
> > erlang-questions (at) erlang.org mailing list.
> > Seehttp://www.erlang.org/faq.html
> > To unsubscribe; mailto:erlang-questions-unsubscr...@REDACTED
>
> --
> --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:erlang-questions-unsubscr...@REDACTED


More information about the erlang-questions mailing list