Which one?
Oh sorry . the first one .
Are you having them type their username in at some point before you want to show this?
Is this a separate scene from your login scene?
Are you remembering the users username and password so they don’t have to type it in every time?
Do you know how to save the username and password locally so they don’t have to type it in every time?
Do you know how to pass data between scenes?
If you don’t know those answers, you should do some research about how to save data, how to pass data between composer scenes, etc.
- No as soon as the sign in they will go to their newsfeed page , and when they click their profile their information will be shown to them . (Profile pics , username , pics posted etc) .
- Yes this is a separate scene from login .
- I want to but I don’t know how .
- No I don’t.
- I don’t think so
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
Do I do this :
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));
in PHP ?
Correct
How do I do this :
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).
?
How do I put the username and pics in this table ?
Is this a good start ? :
$profile = array("", "", "");
Where do I go from there ?
How does that help ?
@comeUp264 (changed to HRH…) You might want to consider hiring someone to do this for you or to teach you.
is that an offer Ed?
I don’t have any money . That’s why I’m doing it myself
You think you can help ?
That is not an offer. Only a suggestion.
I may be completely wrong, but as I read these questions I see a lack of understanding relative to the things @comeUp264 (changed to HRH…) wants to accomplish. So much so, that for anyone to help would require a significant expenditure of time and effort as well as a series of very long answers with accompanying downloadable content, links to resources, et al.
These questions are being asked simply, but the topics are not simple.
In short, I don’t see progress being made on these questions any time soon w/o some dedicated and direct assistance.
Again, I’m not offering but I do think it may be time for @comeUp264 (changed to HRH…) to:
- Simplify goals.
- OR -
- Get a pro (i.e. paid person) to help.
I offer firebase plugins ( not including corona fcm plugin)
https://marketplace.coronalabs.com/search?search=Firebase
I don’t know how decated you are you own server but it is a great option if you don’t want to do any code setup.
My networking skills are very limited, so I don’t think I can help much.
Thanks .
I don’t know what else I have to say when I ask a question . I always say what I need to .
Even when you think this, there is is always a little more everyone can do.