Ok, so I'm new to livecode and php. So far I have been able to create a simple php script on my host server to query a MySQL database.
What I'm trying to figure out is how I pull those results into livecode. I understand how I can call the URL for the php script, but I'm not sure how I would take query results from the php script and put them into variables in my livecode application.
Essentially what I'm trying to do is pull results from the database and create a clickable list, that would let the user drill down into that result with the rest of the info from that row.
I hope that makes sense, any help would be appreciated.
Php MySQL noob
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Php MySQL noob
Yes, it makes sense.
And it's very simple.
-create a very simple php script that will display the result of query. nothing more.
like "SELECT * FROM MY TABLE"
After in livecode do something like :
Now, more complicated : you want to pass a parameter to your php script (a string that your php script will use to query the database)...
Of course, in your PHP script you have to handle the POST.
To go further :
-you will have to take care of security
-by using encryption
-by doing a "sterilization" of the parameters you send to the PHP script (to avoid "injection attacks")
-you'll find on this forum some discussions about it
Last possibility : doing the same with... LiveCode Server
Soon opensource !

-create a very simple php script that will display the result of query. nothing more.
like "SELECT * FROM MY TABLE"
After in livecode do something like :
Code: Select all
put URL "http://www.mysite.com/myscript.php" into myResults
answer myResults
Code: Select all
put "HELLO" into myParameter
put "myparameter="&urlencode(myParameter) into leMessage
post leMessage to url "http://www.mysite.com/myscript.php"
put it into myResults
answer myResults
To go further :
-you will have to take care of security
-by using encryption
-by doing a "sterilization" of the parameters you send to the PHP script (to avoid "injection attacks")
-you'll find on this forum some discussions about it
Last possibility : doing the same with... LiveCode Server

Re: Php MySQL noob
Great! I've got everything almost working as needed...minus the security side. (I'll need to spend more time researching that).
One further question that may be less obvious to answer. When I test my code in live code itself it work perfectly fine and populates the list. When I test it with iOS simulator it does not populate the list. Any thoughts on that?
Thanks for the help!
One further question that may be less obvious to answer. When I test my code in live code itself it work perfectly fine and populates the list. When I test it with iOS simulator it does not populate the list. Any thoughts on that?
Thanks for the help!