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

11011131516

Comments

  • Shenanigans StudioShenanigans Studio Member, PRO Posts: 73

    Thanks @Manto ! I had the table as 'datatest' instead of 'testdata' stupid mistake on my behalf, but its working just fine now! Also, how do I change the Send/Recieve URL to change it from local host to an online server?

  • MantoManto Member Posts: 796

    @Shenanigans Studio said:
    Thanks @Manto ! I had the table as 'datatest' instead of 'testdata' stupid mistake on my behalf, but its working just fine now! Also, how do I change the Send/Recieve URL to change it from local host to an online server?

    Great!

    You need to host it somewhere. Do you happen to have a Web server (website)? As far as I know many of those have support for php, so you could upload the file there.

    If you don't have a web server that has php support, you might want to take a look at heroku, it's free for small use.

  • Shenanigans StudioShenanigans Studio Member, PRO Posts: 73

    @jonmulcahy Just made an account with them! I was able to make a database through site5 too, but how do I come up with the URL?

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408

    @Shenanigans Studio said:
    @jonmulcahy Just made an account with them! I was able to make a database through site5 too, but how do I come up with the URL?

    If you put it in the public_html folder it'll just be domain.com/file.php

    If it's in a sub folder, you add that to the url

  • Shenanigans StudioShenanigans Studio Member, PRO Posts: 73

    @jonmulcahy said:

    @Shenanigans Studio said:
    @jonmulcahy Just made an account with them! I was able to make a database through site5 too, but how do I come up with the URL?

    If you put it in the public_html folder it'll just be domain.com/file.php

    If it's in a sub folder, you add that to the url

    Thats the send/recieve URL? I put it in the folder and put in the link and im getting a "0" callback

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408

    @Shenanigans Studio said:

    @jonmulcahy said:

    @Shenanigans Studio said:
    @jonmulcahy Just made an account with them! I was able to make a database through site5 too, but how do I come up with the URL?

    If you put it in the public_html folder it'll just be domain.com/file.php

    If it's in a sub folder, you add that to the url

    Thats the send/recieve URL? I put it in the folder and put in the link and im getting a "0" callback

    yea, but you need to replace domain.com with the domain you registered.

    for example, lets say I have http://www.awesomegame.com

    and when I FTP up my file, I put it in \public_html\async.php

    I would use http://www.awesomegame.com/async.php as the URL.

    If I put the file in \public_html\sync, the URL would be http://www.awesomegame.com/sync/async.php

  • Shenanigans StudioShenanigans Studio Member, PRO Posts: 73

    This is where I have my file. My domain name: "www.forgedhero.com" So I have "http://www.forgedhero.com/leaderboard.php" Anything wrong with this that you can see?

  • Shenanigans StudioShenanigans Studio Member, PRO Posts: 73

    I see now I had in the subfolder "wp-includes", but I moved it to the main folder and still no success

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    edited June 2016

    @Shenanigans Studio said:
    I see now I had in the subfolder "wp-includes", but I moved it to the main folder and still no success

    I get a 404, file not found, error when I try to browse to the file here: http://www.forgedhero.com/leaderboard.php

  • Shenanigans StudioShenanigans Studio Member, PRO Posts: 73
    edited June 2016

    @jonmulcahy
    I got this when I tried viewing it via the link in my files database if it helps at all

    Edit: Fixed it! I uploaded the .php via the "upload" button instead of doing an FTP upload. My gs project now returns a negative 1 callback, which Im sure I can handle myself. hopefully lol
    Thanks Jon and Manto you guys were a huge help!

  • Shenanigans StudioShenanigans Studio Member, PRO Posts: 73

    @jonmulcahy I tried debugging this one on my own I really did, but im going insane here. Im getting these errors:

    PHP Warning: Unexpected character in input: '
    ' (ASCII=11) state=0 in C:\MAMP\bin\mamp\leaderboard.php on line 78

    [01-Jul-2016 02:00:47 UTC] PHP Warning: Unexpected character in input: '
    ' (ASCII=11) state=0 in C:\MAMP\bin\mamp\leaderboard.php on line 80

    However these lines are in the exact same format as the other lines 75-85.

  • MantoManto Member Posts: 796

    @Shenanigans Studio said:
    @jonmulcahy I tried debugging this one on my own I really did, but im going insane here. Im getting these errors:

    PHP Warning: Unexpected character in input: '
    ' (ASCII=11) state=0 in C:\MAMP\bin\mamp\leaderboard.php on line 78

    [01-Jul-2016 02:00:47 UTC] PHP Warning: Unexpected character in input: '
    ' (ASCII=11) state=0 in C:\MAMP\bin\mamp\leaderboard.php on line 80

    However these lines are in the exact same format as the other lines 75-85.

    You have some strange characters in your $value. ASCII 11 seems to mean vertical tab. Where does the $value string come from? Is it something you've set in the php file?

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408

    @Manto said:

    @Shenanigans Studio said:
    @jonmulcahy I tried debugging this one on my own I really did, but im going insane here. Im getting these errors:

    PHP Warning: Unexpected character in input: '
    ' (ASCII=11) state=0 in C:\MAMP\bin\mamp\leaderboard.php on line 78

    [01-Jul-2016 02:00:47 UTC] PHP Warning: Unexpected character in input: '
    ' (ASCII=11) state=0 in C:\MAMP\bin\mamp\leaderboard.php on line 80

    However these lines are in the exact same format as the other lines 75-85.

    You have some strange characters in your $value. ASCII 11 seems to mean vertical tab. Where does the $value string come from? Is it something you've set in the php file?

    What he said :)

  • Shenanigans StudioShenanigans Studio Member, PRO Posts: 73
    edited July 2016

    @jonmulcahy said:

    @Manto said:

    @Shenanigans Studio said:
    @jonmulcahy I tried debugging this one on my own I really did, but im going insane here. Im getting these errors:

    PHP Warning: Unexpected character in input: '
    ' (ASCII=11) state=0 in C:\MAMP\bin\mamp\leaderboard.php on line 78

    [01-Jul-2016 02:00:47 UTC] PHP Warning: Unexpected character in input: '
    ' (ASCII=11) state=0 in C:\MAMP\bin\mamp\leaderboard.php on line 80

    However these lines are in the exact same format as the other lines 75-85.

    You have some strange characters in your $value. ASCII 11 seems to mean vertical tab. Where does the $value string come from? Is it something you've set in the php file?

    What he said :)

    Thanks guys! I went and checked my vertical tabs and the two problem values were in columns 44 and the rest were in 4, I accidently did a soft return instead of a hard return. So now the errors are gone but now Im getting a 0 callback with no errorlogs. I checked forgedhero.com/leaderboard.php and I get "Error: Could not connect to MySQL server!"

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408

    @Shenanigans Studio said:

    @jonmulcahy said:

    @Manto said:

    @Shenanigans Studio said:
    @jonmulcahy I tried debugging this one on my own I really did, but im going insane here. Im getting these errors:

    PHP Warning: Unexpected character in input: '
    ' (ASCII=11) state=0 in C:\MAMP\bin\mamp\leaderboard.php on line 78

    [01-Jul-2016 02:00:47 UTC] PHP Warning: Unexpected character in input: '
    ' (ASCII=11) state=0 in C:\MAMP\bin\mamp\leaderboard.php on line 80

    However these lines are in the exact same format as the other lines 75-85.

    You have some strange characters in your $value. ASCII 11 seems to mean vertical tab. Where does the $value string come from? Is it something you've set in the php file?

    What he said :)

    Thanks guys! I went and checked my vertical tabs and the two problem values were in columns 44 and the rest were in 4, I accidently did a soft return instead of a hard return. So now the errors are gone but now Im getting a 0 callback with no errorlogs. I checked forgedhero.com/leaderboard.php and I get "Error: Could not connect to MySQL server!"

    I'm guessing the either the name of the database or the login information is wrong. Should be at the top of the file.

  • Shenanigans StudioShenanigans Studio Member, PRO Posts: 73
    edited July 2016

    @jonmulcahy that was my first thought too, but everything looks good on that end. Am i getting all the details from the right place? Or is it my $link that needs editing? I never changed it.

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408

    @Shenanigans Studio said:
    @jonmulcahy that was my first thought too, but everything looks good on that end. Am i getting all the details from the right place? Or is it my $link that needs editing? I never changed it.

    Yes your link is bad. Db should be fordhed_leaderboard, and the username will be something like forged_username. In phony admin you can create an account of you haven't already

  • Shenanigans StudioShenanigans Studio Member, PRO Posts: 73

    @jonmulcahy said:

    @Shenanigans Studio said:
    @jonmulcahy that was my first thought too, but everything looks good on that end. Am i getting all the details from the right place? Or is it my $link that needs editing? I never changed it.

    Yes your link is bad. Db should be fordhed_leaderboard, and the username will be something like forged_username. In phony admin you can create an account of you haven't already

    @jonmulcahy Is this the "phony admin" username and password you were referring to? I put this in the
    $link = @mysql_connect(':/Applications/MAMP/tmp/mysql/mysql.sock', 'forgedhe_wp217', '*********')

    still not working.
    Is ":/Applications/MAMP/tmp/mysql/mysql.sock" the issue perhaps? Im not sure where this path comes from to be honest.

  • MantoManto Member Posts: 796
    edited July 2016

    @Shenanigans Studio said:

    @jonmulcahy said:

    @Shenanigans Studio said:
    @jonmulcahy that was my first thought too, but everything looks good on that end. Am i getting all the details from the right place? Or is it my $link that needs editing? I never changed it.

    Yes your link is bad. Db should be fordhed_leaderboard, and the username will be something like forged_username. In phony admin you can create an account of you haven't already

    @jonmulcahy Is this the "phony admin" username and password you were referring to? I put this in the
    $link = @mysql_connect(':/Applications/MAMP/tmp/mysql/mysql.sock', 'forgedhe_wp217', '*********')

    still not working.
    Is ":/Applications/MAMP/tmp/mysql/mysql.sock" the issue perhaps? Im not sure where this path comes from to be honest.

    Yes, that's likely the problem. You should find the URL for the database on your hosting site. Probably in the remote tab.

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408

    @Manto said:

    @Shenanigans Studio said:

    @jonmulcahy said:

    @Shenanigans Studio said:
    @jonmulcahy that was my first thought too, but everything looks good on that end. Am i getting all the details from the right place? Or is it my $link that needs editing? I never changed it.

    Yes your link is bad. Db should be fordhed_leaderboard, and the username will be something like forged_username. In phony admin you can create an account of you haven't already

    @jonmulcahy Is this the "phony admin" username and password you were referring to? I put this in the
    $link = @mysql_connect(':/Applications/MAMP/tmp/mysql/mysql.sock', 'forgedhe_wp217', '*********')

    still not working.
    Is ":/Applications/MAMP/tmp/mysql/mysql.sock" the issue perhaps? Im not sure where this path comes from to be honest.

    Yes, that's likely the problem. You should find the URL for the database on your hosting site.

    yea, that is exactly the problem. You're passing in the local path of your mysql database, but your website is online. try changing it to localhost, thats what I have

  • Shenanigans StudioShenanigans Studio Member, PRO Posts: 73
    edited July 2016

    @jonmulcahy @Manto thanks guys! Changed the path to my IP that i found in the remote tab and Im able to access the database. Im now getting a positive 1 callback when im testing, but the table doesnt send or recieve. I know I found the error log in my MAMP folder when testing locally but where can I find it now that my database is online?

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408

    if it's something that the script is outputting, it should be in the same directory as your php file. otherwise in your cpanel on site5 there should be a logs section

  • Shenanigans StudioShenanigans Studio Member, PRO Posts: 73
    edited July 2016

    Found the log and sending and getting data is fully operational, thank you so much jon and manto for being patient with me. I promise Ill leave you guys alone for atleast a few days. you guys are gods!

    -cheers

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408

    @Shenanigans Studio said:
    Found the log and sending and getting data is fully operational, thank you so much jon and manto for being patient with me. I promise Ill leave you guys alone for atleast a few days. you guys are gods!

    -cheers

    no problem, have fun with it!

  • buildbuild Member, PRO Posts: 45

    lets say a new character starts the game on an island, with just a homebase and a bit of gold. And here you will be given a completely empty personal database for the placement data of all your future buildings.
    When you place a new building at a certain location X,Y on the map/scene, That buildings' coordinates and object index number will then be saved to that personal table owned by that players unique player ID.

    Then the map could be visited by other online players. And all of the map's object data, ( X,Y and index number), would then be retrieved from that visited players unique table. That could be found through the players unique player ID

    TLDR; I want to somehow use the "One-to-many" table method, to make a personal table for each unique player ID.
    Or should i just make a massive second table for every unique ID's placement data?

    I just want my map to be visited by other players. There must be a way to somehow save every object placement data onto a table. And when visited, the visitor would get the object placement data from the visited table.

    (sorry for bad gramma)

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408

    @build said:
    lets say a new character starts the game on an island, with just a homebase and a bit of gold. And here you will be given a completely empty personal database for the placement data of all your future buildings.
    When you place a new building at a certain location X,Y on the map/scene, That buildings' coordinates and object index number will then be saved to that personal table owned by that players unique player ID.

    Then the map could be visited by other online players. And all of the map's object data, ( X,Y and index number), would then be retrieved from that visited players unique table. That could be found through the players unique player ID

    TLDR; I want to somehow use the "One-to-many" table method, to make a personal table for each unique player ID.
    Or should i just make a massive second table for every unique ID's placement data?

    I just want my map to be visited by other players. There must be a way to somehow save every object placement data onto a table. And when visited, the visitor would get the object placement data from the visited table.

    (sorry for bad gramma)

    I would probably do a single table with everyone's stuff sorted by a unique GUid. I don't think it would work otherwise, I think you need an existing table to download to

  • buildbuild Member, PRO Posts: 45

    Then what if a player had more than 100 buildings?
    I mean the tables in gamesalad maxes out at 100 rows.

    And how do i call the ID specific placement data from a table with thousands of IDs?

    Im also not quite sure how to add multiple table values to the .php file.

    These are the only problems stopping me from creating my game.

    Execpt for the bugged custom collisions, but thats another topic

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408

    @build said:
    Then what if a player had more than 100 buildings?
    I mean the tables in gamesalad maxes out at 100 rows.

    And how do i call the ID specific placement data from a table with thousands of IDs?

    Im also not quite sure how to add multiple table values to the .php file.

    These are the only problems stopping me from creating my game.

    Execpt for the bugged custom collisions, but thats another topic

    I have tables with 999 rows and 999 columns. Maybe you have to import to get above he limit? It's been awhile since I've looked. I also use a Mac

  • NNterprisesNNterprises Member, PRO Posts: 387

    Yes you can only get large tables with importing CSV files. I have a 200 x 3 table in one and I cannot see any rows past like 50 or something, but it still works I just have to open the file separately to see what's there...

Sign In or Register to comment.