database retrieve problem

NavaTux navaneethanit@REDACTED
Sun Mar 28 18:37:02 CEST 2010


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..


More information about the erlang-questions mailing list