Hello,
I 'm not sure if this is the right place to post about this, but I do like to learn from here and there, so here is my question:
I'm building my site with a server offering many capabilities among which the connection to mysql databases through its extensions which I only know how to code a little with AS 2.
I want to build a form or gueestbook that connects to one, but I can't make it insert data into it unless the INT value in the database is BIGINT if I want to have it autoincrement itself chronologically. My doubt is whether that is due to my client side in AS 2 or how I prepare the database.
In the client side, Flash I have this code to insert the values into the database:
In the extension :Code:function addRecord() { var req:Object = {} if (add_name_txt.text != "") { req.name = add_name_txt.text req.location = add_location_txt.text req.email = add_email_txt.text // Clear textfields add_name_txt.text = add_location_txt.text = add_email_txt.text = "" smartfox.sendXtMessage(extensionName, "addData", req, "xml") } }
In the database the Id row is BIGINT (20) and the rest of the fiels are varchar 255. If I try to make it INT(11) and autoincrement on, nothing is added to the database.Code:else if (cmd == "addData") { var id = getTimer() var sql = "INSERT INTO contacts (id, name, location, email) VALUES (" sql += "'" + id + "', " sql += "'" + _server.escapeQuotes(params.name) + "', " sql += "'" + _server.escapeQuotes(params.location) + "', " sql += "'" + _server.escapeQuotes(params.email) + "')" var success = dbase.executeCommand(sql) { var response = {} response._cmd = "addData" response.id = id response.name = params.name response.location = params.location response.email = params.email _server.sendResponse(response, -1, null, [user]) } }
I still haven't tried getting rid off the getTimer variable and changing the database again, could that be it? Whenever I look into the id values are very large, like this one: 1382786279642




Reply With Quote