Why isn't this working!!!
It is failing on the cn.Execute(sql, args) saying:
here is e:
e.ulink = "ulink"
e.event = "event"
e.desc = "description"
e.cur_page = "cur_page"
e.user_agent = "user_agent"
e.ip = "ip"
They are all at least varchar(50) in MySql
It is failing on the cn.Execute(sql, args) saying:
Code:
Database API specific error Your database has returned the following error code and description to Alpha Five. Consult your database documentation for further information. 1064 - 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc, cur_page, user_agent, ip) VALUES ('ulink','event','description','cur_page'' at line 1'
Code:
'Date Created: 27-Jun-2011 01:34:31 PM'Last Updated: 05-Aug-2011 11:16:06 AM FUNCTION write2log as L (e as p) 'e.ulink - Character - ulink of the user 'e.event - Character - Event that we're logging 'e.desc - Character - Any extra description we're logging, such as bad sql code. 'e.cur_page - Character - Current page 'e.user_agent - Character - User agent of the client 'e.ip - Character - IP Address of the remote client debug(1) 'Connect to a SQL database dim cn as SQL::Connection dim flag as L flag = cn.Open("connection string goes here!!!") if flag = .f. then ?"Error: " + cn.callresult.text write2log = .f. end if dim args as sql::arguments if eval_valid("e.ulink") then args.add("ulink",e.ulink) end if if eval_valid("e.event") then args.add("event",e.event) end if if eval_valid("e.desc") then args.add("desc",e.desc) end if if eval_valid("e.cur_page") then args.add("cur_page",e.cur_page) end if if eval_valid("e.user_agent") then args.add("user_agent",e.user_agent) end if if eval_valid("e.ip") then args.add("ip",e.ip) end if dim sql as c sql = "INSERT INTO gen_log (ulink, event, desc, cur_page, user_agent, ip) VALUES (:ulink,:event,:desc,:cur_page,:user_agent,:ip);" flag = cn.Execute(sql,args) if flag = .f. then ?"Error: " + cn.CallResult.text write2log = .f. end if write2log = .t. cn.FreeResult() cn.Close() END FUNCTION
e.ulink = "ulink"
e.event = "event"
e.desc = "description"
e.cur_page = "cur_page"
e.user_agent = "user_agent"
e.ip = "ip"
They are all at least varchar(50) in MySql
Comment