Okay, you are going to need another PHP script. Call it profile.php. You will use “GET” instead of “POST”. I’m assuming you eventually want to be able to get any one’s profile.
http://yoursite.com/profile.php?q=playersusername
Then that script will query your MySQL database to find the profile information for that username and you will probably have a second query to get pics posted etc. Put all of that into a PHP Associative Array (similar to a Lua table). Then
echo (json\_encode(yourProfileTable));
that will create data that can be passed back to Corona’s network.request()'s network listener function. This means that you will have to have another network.request() to request your profile.php script that includes the username as part of the URL. You will need a unique listener function for this. When you get it, you will do something like:
local profile = json.decode( event.response )
at that point you will have a table named profile that will have all of your data that you fetched in your script and added to the associative array.
Now to do this, you will have to keep the username in memory where they logged in. The easiest way to do this is to use the composer.setVariable() and composer.getVariable() functions, when you login call:
composer.setVariable(“username”, yourusernametextstring )
Then when you’re ready to make that network request you can:
local profile local function yourProfileListener( event ) if not event.isError then profile = json.decode( event.response ) -- do whatever you need to do with your profile end end local URL = "http://yoursite.com/profile.php?q=" .. composer.getVariable("username") network.request(URL, "GET", yourProfileListener)
This code will likely be part of your profile.lua scene where you’re going to show all of this. Most likely you will code this in your scene:show()'s “will” phase and you will create your various display objects here.
Rob