Simple .lc Script to INSERT data...?
Matthias Rebbe | M-R-D
matthias_livecode_150811 at m-r-d.de
Fri Jun 5 18:39:33 EDT 2015
if you post data to a livecode server script then you need to use $_post instead of $_get
$_get is used if you add the parameters to the url like
put URL ("http://username.on-rev.com/ipad_1/add_datga_2.lc?object_name=“ & tName) into tResult
> Am 06.06.2015 um 00:31 schrieb JOHN PATTEN <johnpatten at me.com>:
> Hi All,
> I must be missing something simple and I can’t find it…
> I have a mysql database with one table and one field. Varchar(1000)
> I have a LiveCode project with one button and the following code:
> on mouseUp
> put urlEncode(the name of target) into tName
> put "object_name=" & tName into ArgList
> --answer ArgList
> post tArgList to URL "http://username.on-rev.com/ipad_1/add_data_2.lc"
> end mouseUp
> My .lc file looks like this:
> put revOpenDatabase ("mysql”,"username.on-rev.com”,"username_ipad_2”,"username_ipad_2”,"password") into tConID
> put "ipad_data" into tTableName
> put $_GET["object_name"] into object_name
> put "object_name" into tFields
> put "INSERT INTO" && tTableName && "(" & tFields & ") VALUES (:1);" into tSQL
> revExecuteSQL tConID, tSQL, "object_name"
> revCloseDatabase tConID
> put empty
> The .lc script creates a new record but it never puts the name of the button in the object_name field? The record is completely empty. I was having the same problem on a much more complex database and script, so I thought I would super simplify but I’m still having the problem.
> Does anybody see anything I’m missing?
> Thank you!
> John Patten
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
More information about the Use-livecode