Simple .lc Script to INSERT data...?

JOHN PATTEN johnpatten at me.com
Sat Jun 6 18:46:29 EDT 2015


Yup. That was it… It’s incredible how easy it is to miss this kind of thing and waste time :( 

I can’t wait until I can just tell the robot to write the code for what I describe. The robot would never make this type of error ;)

Thanks Again!


> On Jun 5, 2015, at 5:14 PM, Mike Bonner <bonnmike at gmail.com> wrote:
> 
> You're putting your data to post into ArgList
> And you're posting tArgList
> 
> If thats not a typo here, I suspect its the typo culprit there.
> 
> On Fri, Jun 5, 2015 at 5:01 PM, JOHN PATTEN <johnpatten at me.com> wrote:
> 
>> Thanks Matthias,
>> 
>> I did try both ways $_POST and $_GET.  I get the same results; a new
>> record is created but the fields are empty.  By the way, the "LiveCode
>> Cloud" tutorials show $_POST for inserting new record too.
>> 
>> I’ll keep looking :)
>> 
>> 
>>> On Jun 5, 2015, at 3:39 PM, Matthias Rebbe | M-R-D <
>> matthias_livecode_150811 at m-r-d.de> wrote:
>>> 
>>> John,
>>> 
>>> 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
>>> 
>>> Regards,
>>> 
>>> Matthias
>>> 
>>> 
>>> 
>>> 
>>>> 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:
>>>> 
>>>> <?lc
>>>> 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
>>>> SUSD
>>>> 
>>>> _______________________________________________
>>>> use-livecode mailing list
>>>> use-livecode at lists.runrev.com
>>>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>> 
>>> 
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the Use-livecode mailing list