Sending and Receiving data using your own SQL Server - PHP file and TestProject included

1246716

Comments

  • PhoticsPhotics Member Posts: 4,172
    @Photics the Playstogether requirement has been removed for "my own server" communication and it's in the newest nightly, I honestly don't know when it will be in the next non nightly version.
    Ah, that is good news. Unfortunately, nightly builds are for Pro subscribers. I could renew my subscription today, but I'm not releasing any new GameSalad apps until metrics gathering goes away.

    But wow, this is very interesting stuff. GameSalad is close.

    I've been wondering what to do about my site. I've been thinking about giving up on the app development thing, as there are other projects I could work on. But after seeing stuff like this, I'm starting to wondering about the possibilities again.
  • EireStudiosEireStudios Member Posts: 451
    @Photics I'm not really releasing any apps myself but trust me, I'm having an awful amount of fun with the nightly builds lately :)

    @jonmulcahy pm sent mate!
  • PhoticsPhotics Member Posts: 4,172
    I'm not really releasing any apps myself but trust me, I'm having an awful amount of fun with the nightly builds lately :)
    Fun, I seem to forgotten about that.

    Also, I was thinking about the encryption issue... and maybe I'm overthinking it. Maybe it works over https? I'm busy with a book project right now, but maybe I can play with GameSalad again soon.
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    @Photics I'm not really releasing any apps myself but trust me, I'm having an awful amount of fun with the nightly builds lately :)

    @jonmulcahy pm sent mate!
    I'm not really releasing any apps myself but trust me, I'm having an awful amount of fun with the nightly builds lately :)
    Fun, I seem to forgotten about that.

    Also, I was thinking about the encryption issue... and maybe I'm overthinking it. Maybe it works over https? I'm busy with a book project right now, but maybe I can play with GameSalad again soon.
    @Photics, it's good to see you on the forum and still considering coming back to the GS ranks. @EireStudios is certainly right... this new stuff and the recent progress from the GS team in general is very exciting and good honest fun. It feels like the GameSalad software has hit it's teenage years and is having a massive growth spurt (I guess they've sorted out the mess of the old code and we're finally seeing the benefits). It was enough to make me pay to go pro for the first time in over a year (mainly Jon Mulcahys fault actually for doing this tutorial and I wanted to have a go). Just so I could start tinkering with it and keep my knowledge of the system up to date and growing.

    This plus the game I've been ever so incredibly slowly making now for the past 6 months will make use of multiplayer and I want to do it right... Tempted to try and not use Playstogether at all, just because there's that tiny tiny chance the game is a hit and someone wants to buy it off me in the distant future for squillions. It would be easier to sell if I owned the asynchronous server side aspect.

    Good luck with book project. Jon.
  • jigglybeanjigglybean Member Posts: 1,584
    edited February 2014
    Can anyone recommend a MAMP equivalent for windows?

    Found one
    http://www.wampserver.com/en/

    Like Balls? Then click here! We've 100 coming soon

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    Can anyone recommend a MAMP equivalent for windows?

    Found one
    http://www.wampserver.com/en/

    I've used WAMP before. Should be pretty much the same except folder/file locations. It's a great way to setup a quick and dirty test server to make sure all your code works before setting up a real server.
  • EireStudiosEireStudios Member Posts: 451
    Hi @jonmulcahy, I have a few questions for you mate! How is the $jsonFooter id generated?

    I'm working on a gym booking in app for a friend and I'm running into a problem, I currently have 2 apps, one Trainer app for creating new clients, checking number of bookings, times, client progress etc and I have another Client app which the clients can book in and check their weekly weigh ins etc

    My problem is that I need to be able to access the same database from both the apps but when I use the Client app is generates a different jsonFooterID in the json.txt file than the Trainer app, any idea how I could fix this? or could you give me more information as to how its generated?
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    @EireStudios you should be able to do it by making two separate PHP files... with the appropriate jsonFooter in..

    Then the Trainer app would send (or Get) from one PHP url, the other using the other PHP URL. In both the PHP scripts you could connect to the same database and table and read or write to it....

    Think that's correct.
  • EireStudiosEireStudios Member Posts: 451
    edited February 2014
    @StormyStudio Thanks man I'll give that a whirl and see how I get on :)

    I bet your working in a really Stormy Studio today mate, we are getting the same crazy weather here too, over 100mph winds, trees blown everywhere. Have a safe few days mate!

    Edit - Thanks man that worked perfect, its the simple things that seem to catch me lately with all the php and mysql I'm trying to cram into my brain I think its pushing all the simple logic out to make room :D
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    @EireStudios cool, glad it works....
    and yeah my Stormy Studio has been living up to its name...... I think 90mph winds is our top so far..the flooding news this week is just crazy... our old house, which we sold back in July before the big move to Devon last year has finally been flooded today by the Thames despite being quite a way away. We got a call from the Environment Agency telling us to evacuate... Very pleased to have sold and moved already... would be a lot harder to sell that one now... some of Sommerset is metres deep now. Good luck to anyone out there who is getting the worst of it..



  • EireStudiosEireStudios Member Posts: 451
    @EireStudios cool, glad it works....
    and yeah my Stormy Studio has been living up to its name...... I think 90mph winds is our top so far..the flooding news this week is just crazy... our old house, which we sold back in July before the big move to Devon last year has finally been flooded today by the Thames despite being quite a way away. We got a call from the Environment Agency telling us to evacuate... Very pleased to have sold and moved already... would be a lot harder to sell that one now... some of Sommerset is metres deep now. Good luck to anyone out there who is getting the worst of it..



    Wow you got a very lucky escape there mate!

    The winds are now topping 160mph here now and I'm living in Cork which is one of the worst effected places, our government has issued a state of emergency, reports of power cuts, road closures, flooding, and believe it or not people being blown into walls and traffic receiving very serious injuries, time to stock up on supplies, and lock myself and the family away for a few days!

    You guys have some serious flooding right now, we were just watching some footage online, really crazy stuff, let's hope everyone makes it out safe!

  • beefy_clyrobeefy_clyro Member Posts: 5,390
    This is great! Excellent work @jonmulcahy

    Still trying to get my head around it all haha

    Got the demo working, then tried to get my own going using the php file you included but changing relevant database and table names but when I hit get table, it just opens safari saying it could not Connect to localhost!
    Dunno what I'm missing to be honest! Going to sleep on it now
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    This is great! Excellent work @jonmulcahy

    Still trying to get my head around it all haha

    Got the demo working, then tried to get my own going using the php file you included but changing relevant database and table names but when I hit get table, it just opens safari saying it could not Connect to localhost!
    Dunno what I'm missing to be honest! Going to sleep on it now
    check the logs under applications/mamp/logs

    the apache log is for the web server, the error log might have something.
    the php log is for the execution of php scripts, useful when you forget a ;, or just have bad code :)

    and of course make sure the service is running :)
  • beefy_clyrobeefy_clyro Member Posts: 5,390
    I think I may know part of the problem Jon, although I changed the php file to the correct database name and table, I never changed that file for things like columns names! Will have a bit of a play over the weekend. All I really want to be able to achieve is the receive side of it!
    Good to know about the log files though! This is really exciting stuff :D
  • beefy_clyrobeefy_clyro Member Posts: 5,390
    So I've been having a play today and have successfully managed to query a table on my own web server and pull the data! Proper cool seeing it work for the 1st time … This is awesome. Thanks @jonmulcahy
  • JDuaneJJDuaneJ San Francisco Member Posts: 300

    @jonmulcahy Man this is what i've been waiting for the last 3 years! Awesome work! I can totally use this to grab some analytical data from my apps now. I plan on trying to gather simple requests like device time and play time. Would help me to know what time of day my users are opening my apps and games, and how long they play/read. Super sweet!

    Question: Do I need to have a Playstogether account in order to make use of the Send and Get functions in GS? Not interested in multiplayer, just getting data from my game dumped to a server of some kind.

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408

    @jonmulcahy Man this is what i've been waiting for the last 3 years! Awesome work! I can totally use this to grab some analytical data from my apps now. I plan on trying to gather simple requests like device time and play time. Would help me to know what time of day my users are opening my apps and games, and how long they play/read. Super sweet!

    Question: Do I need to have a Playstogether account in order to make use of the Send and Get functions in GS? Not interested in multiplayer, just getting data from my game dumped to a server of some kind.

    No you don't! that's the beauty of this. The very first implementation of this you did, but soon after they added the 'my own server' option, which allows you to do everything yourself.
  • JDuaneJJDuaneJ San Francisco Member Posts: 300

    Brilliant! Thanks @jonmulcahy for your work helping us out on this one. My next game might just use this. I'll report back my experiences with it for data mining my apps. Nice!

  • AlkaPPAlkaPP Member, PRO Posts: 194

    Hi all,

    I've followed the instruction and successfully send and get data locally. I've tried to take a further step by trying to do it with my own online hosting server. Here was what I did:

    1. Created a database and table using my hosting server just like I did for the local MAMP. I didn't use username and password for this database since it is for testing only.
    2. Updated the asyncTest.php file to match the database and table.
    3. Uploaded asyncTest.php, json.txt and directory php/function.php to my server.
    4. Updated the sendURL and receiveURL attribute to my server URL. (my url: http://toyspartyshop.com/database/asyncTest.php)

    When I browse the http://toyspartyshop.com/database/asyncTest.php, no database connection error showed, so I guess it is connected to the database successfully.

    I opened gamesalad and tried to click on the get button, but nothing happened.

    Obviously something wrong. I've tried a couple hours to figure out, but still not able to fix it.

    My questions:

    1. What other files do I need to upload to my server?
    2. What else do I need to modify in the asyncTest.php file? Do I need to change the $port and $link?
    3. Did I change the url attribute correctly to pointing them to http://toyspartyshop.com/database/asyncTest.php?

    Thanks in advance,

    Alan,

    My Gamesalad Games On App Store:

    Greedy Chubby: https://itunes.apple.com/us/app/greedy-chubby/id834371213?ls=1

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408

    Check the logs on your server, if there's an error it might have something.

  • AlkaPPAlkaPP Member, PRO Posts: 194

    i finally got it working on my server, but not completely. All i got is when i click "send", the database got updated with the datas id, name and stats. That's all. The tablesendstatus is still 0, no green light even though the data was sent successfully to mysql. Also, when i clicked on get, nothing happen at all. I've updated my receiveurl attribute just like i did for the send url. Any help would be appreciated.

    My Gamesalad Games On App Store:

    Greedy Chubby: https://itunes.apple.com/us/app/greedy-chubby/id834371213?ls=1

  • DoguzDoguz Member Posts: 500

    Check out a game called 'puzzle retreat' and it's Facebook comments integration. That's what I want. It looks like they have a webpage setup for each level and Players can interact using a facebook comments plugin. Brilliant.

  • EireStudiosEireStudios Member Posts: 451

    @AlkaPP said:
    i finally got it working on my server, but not completely. All i got is when i click "send", the database got updated with the datas id, name and stats. That's all. The tablesendstatus is still 0, no green light even though the data was sent successfully to mysql. Also, when i clicked on get, nothing happen at all. I've updated my receiveurl attribute just like i did for the send url. Any help would be appreciated.

    I had the same problem as this when I first started to mess around with it. Make sure you copy exacted what's in the json.txt file and paste it down near the bottom of your .php file, if these don't match exactly you won't be able to receive anything from the server!

  • AlkaPPAlkaPP Member, PRO Posts: 194

    Thanks Eire, this might not be the problem that i'm having. I didn't edit the json part at the end of the file at all. Also, i might be wrong, i thought that the header and footer part of json will import into json.txt file and insert the table content as body. Any other suggestion Eire?

    My Gamesalad Games On App Store:

    Greedy Chubby: https://itunes.apple.com/us/app/greedy-chubby/id834371213?ls=1

  • EireStudiosEireStudios Member Posts: 451
    edited March 2014

    I have a spare hour at the moment so if you want to send me your .php and json.txt file I can take a look to see if its a problem there?

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408

    @AlkaPP said:
    Thanks Eire, this might not be the problem that i'm having. I didn't edit the json part at the end of the file at all. Also, i might be wrong, i thought that the header and footer part of json will import into json.txt file and insert the table content as body. Any other suggestion Eire?

    did you change the data you are uploading at all? The json structure will be unique to whatever you are doing, so if you've deviated at all you will need to update the php file.

  • AlkaPPAlkaPP Member, PRO Posts: 194

    here are the json and php file: http://midnight12am.com/database.zip

    Don't laugh but i'm not even sure what files needed to be uploaded. I only uploaded the php file and json since i thought that those are the only 2 files i needed to upload. I didn't upload the function.php file in the php directory because i believe it's only used for MAMP.

    I uploaded the php file, and created an empty json.txt file in the same directory "database". After I clicked the send button, the json header and foot and body was successfully inserted into the json.txt file.

    My Gamesalad Games On App Store:

    Greedy Chubby: https://itunes.apple.com/us/app/greedy-chubby/id834371213?ls=1

  • AlkaPPAlkaPP Member, PRO Posts: 194
    edited March 2014

    Also, here are url to the json.txt and php files in my hosting:

    http://midnight12am.com/database/Test.php

    http://midnight12am.com/database/json.txt

    I've changed the receiveURL and sendURL attribute to the http://midnight12am.com/database/Test.php

    My Gamesalad Games On App Store:

    Greedy Chubby: https://itunes.apple.com/us/app/greedy-chubby/id834371213?ls=1

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408

    it worked locally fine right?
    can you check your apache / mysql logs on your server to see if anything is being logged? maybe it's a permissions thing

Sign In or Register to comment.