@Manto I got it working now! I needed to put .php?username='Jake' instead of .php?username=Jake. Thanks for all your help and patience, you're the best man!
@Shenanigans Studio said: @Manto I got it working now! I needed to put .php?username='Jake' instead of .php?username=Jake. Thanks for all your help and patience, you're the best man!
Great! You're welcome!
However, you shouldn't do that in the url, but in the SQL query. So $query = mysql_query("SELECT 1 FROM ".$tableName." WHERE username = '".$_GET["username"]."'");
Seeing this is the most exciting thing that's ever happened to me:
So, I got it working, though it's 4 days of my life I'll never get back! The silver lining is that I now have a rudimentary grasp of PHP and SQL.
Thanks @jonmulcahy for pioneering this and thanks @Manto for the incredible help!
Aside from a few tweaks, this turned out to indeed be a server issue. It was tricky though because it sorta worked sometimes, enough for me to continue trying to perfect the code (which was beating a dead horse.)
So, ifast.net works as a host server for this, and their customer service was quite helpful in the end.
If you are experience problems talk to your hostserver. This is what I got from them:
"mod security in your cPanel was blocking the request"
If you haven't done the json returning part yet, here's the PHP code for that:
// start GET data
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
// initialize the JSON body variable
$jsonBody="";
// get table contents
$query = mysql_query("SELECT 1 FROM ".$tableName." WHERE username = '".$_GET["username"]."' LIMIT 1");
// construct an array to hold the data we pull from mySQL
$value = mysql_fetch_row($query);
echo('{"Properties":[],"Name":"","Children":[{"Properties":[{"Name":"rowCount","Value":1},{"Name":"columnCount","Value":1},{"Name":"0-1-name","Value":""},{"Name":"0-1-type","Value":4}],"Name":"id262221_headers","Children":[]},{"Properties":[{"Name":"1","Value":"|' .
(!($value) ? "1" : "0") .
'|"}],"Name":"id262221","Children":[]}]}');
} // end of get
So it returns a 1x1 table that contains a single boolean value telling whether the username is available or not.
@JScott said:
Seeing this is the most exciting thing that's ever happened to me:
So, I got it working, though it's 4 days of my life I'll never get back! The silver lining is that I now have a rudimentary grasp of PHP and SQL.
Thanks @jonmulcahy for pioneering this and thanks @Manto for the incredible help!
Aside from a few tweaks, this turned out to indeed be a server issue. It was tricky though because it sorta worked sometimes, enough for me to continue trying to perfect the code (which was beating a dead horse.)
So, ifast.net works as a host server for this, and their customer service was quite helpful in the end.
If you are experience problems talk to your hostserver. This is what I got from them:
"mod security in your cPanel was blocking the request"
Well, I haven't used it with GS, but with similar server side code yes. What are you trying to do?
I was working on leaderboards and I wanted to update everyone's information when a new high score hit the table. But luckily I did find out how to do it. cheers
Though I did mine a bit different by using ORDER BY and INSERT INTO to compare my scores and DELETE any extra rows with that player's ID.
But thank you!
This is completely unrelated, but I ran into a problem that occurs when downloading huge tables off my server. When I try this my game to freezes until the table is fully downloaded. My solution to that is to only retrieve a 10-15 rows and not a couple hundred thousand unnecessary rows. Is there even a way to get a specific row based on a specific attribute in Gamesalad? For example I have 10,000 players, each with their own row in my server. But I only need Player X's row data.
@chaosmasterro said: Is there even a way to get a specific row based on a specific attribute in Gamesalad? For example I have 10,000 players, each with their own row in my server. But I only need Player X's row data.
Yes, you can put parameters to the get table url. See my previous comments. If you don't have usernames, you can use playerID.
Why not let the database check if the username is unique? Send the username using the get table behavior and let the server only return whether the username is available or not. You should be able to send data to server in get table behavior if you add the username to the url, for example like this:
I don't think it works for HTML5. I have a fully functioning project that use network features but it is unable to access the network for html5. I am on my local server mind you.
In my HTML5 version, GET works perfectly but SEND doesn't send anything, despite displaying a 1 for the Callback Attribute. SEND works fine on all other platforms. Enabled CORS on my server. Any ideas?
@loyaltyapps said:
In my HTML5 version, GET works perfectly but SEND doesn't send anything, despite displaying a 1 for the Callback Attribute. SEND works fine on all other platforms. Enabled CORS on my server. Any ideas?
Where is your server? Is it hosted somewhere? Some hosts just don't work
Ah ok. Actually using GoDaddy since I already have several hosting accounts with them. Think that might be the problem? Last year I tried a few of the others mentioned in the forums but they were more confusing. Thanks
@loyaltyapps said:
Ah ok. Actually using GoDaddy since I already have several hosting accounts with them. Think that might be the problem? Last year I tried a few of the others mentioned in the forums but they were more confusing. Thanks
Yes I think people have reported problems with godaddy before. I use site5, always worked
I actually noticed this in the Error Log, not sure whether it's the problem or just a warning for future:
PHP Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in ........... /send.php on line 7
Tried site5. Same problem. SEND not sending anything to the db on the html5 version, despite seeing a 1 for Callback. GET works fine. SEND & GET all good in the Preview and on Android, but no use to me. Any ideas?
enable some of the logging I commented out to make sure your server is receiving the json package, it should just dump it to a txt file. also check the server logs are not showing any permissions / missing file errors
The json.txt and updatedjson.txt files are in the folder, the former is empty, the latter only shows the data from my tests in the GameSalad previewer. It does not display any of the info submitted in the HTML5 version.
Not sure what this means: "enable some of the logging I commented out"
Update: the json.txt is always empty in my File Manager when sent from the HTML5 version. Whereas it contains the correct info when sent from the Preview and Android version. Send.php code attached. Any ideas?
Comments
@Manto I got it working now! I needed to put .php?username='Jake' instead of .php?username=Jake. Thanks for all your help and patience, you're the best man!
Great! You're welcome!
However, you shouldn't do that in the url, but in the SQL query. So
$query = mysql_query("SELECT 1 FROM ".$tableName." WHERE username = '".$_GET["username"]."'");
@Manto Thanks for the tip, updated the code and that works too!
Seeing this is the most exciting thing that's ever happened to me:
So, I got it working, though it's 4 days of my life I'll never get back! The silver lining is that I now have a rudimentary grasp of PHP and SQL.
Thanks @jonmulcahy for pioneering this and thanks @Manto for the incredible help!
Aside from a few tweaks, this turned out to indeed be a server issue. It was tricky though because it sorta worked sometimes, enough for me to continue trying to perfect the code (which was beating a dead horse.)
So, ifast.net works as a host server for this, and their customer service was quite helpful in the end.
If you are experience problems talk to your hostserver. This is what I got from them:
"mod security in your cPanel was blocking the request"
Hopefully it will save you time
Age of Dominion RTS for iOS
Age of Dominion RTS for Android
If you haven't done the json returning part yet, here's the PHP code for that:
So it returns a 1x1 table that contains a single boolean value telling whether the username is available or not.
fantastic!! glad you got it working
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
@jonmulcahy please check ur PMs
GAMESALAD DEV FOR HIRE! - www.gingagaming.com
Thanks for the heads up, I rarely check them. I'll email you this weekend.
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
Question, has anyone been successful when it comes to using the UPDATE commmand in sql and updating multiple rows at once?
Well, I haven't used it with GS, but with similar server side code yes. What are you trying to do?
I was working on leaderboards and I wanted to update everyone's information when a new high score hit the table. But luckily I did find out how to do it. cheers
Though I did mine a bit different by using ORDER BY and INSERT INTO to compare my scores and DELETE any extra rows with that player's ID.
But thank you!
This is completely unrelated, but I ran into a problem that occurs when downloading huge tables off my server. When I try this my game to freezes until the table is fully downloaded. My solution to that is to only retrieve a 10-15 rows and not a couple hundred thousand unnecessary rows.
Is there even a way to get a specific row based on a specific attribute in Gamesalad? For example I have 10,000 players, each with their own row in my server. But I only need Player X's row data.
Yes, you can put parameters to the get table url. See my previous comments. If you don't have usernames, you can use playerID.
Found it! Now, I can pull a specific row of data with this. Excellent! Someone else may come along and may need this too.
I'm trying to get this working for an HTML5 project. Does anybody know if it should work? It works fine for me in the GS Preview and Android app but nothing happens with the HTML5 version. @jonmulcahy @chaosmasterro @Manto @gingagaming @JScott @Shenanigans Studio
I don't think it works for HTML5. I have a fully functioning project that use network features but it is unable to access the network for html5. I am on my local server mind you.
Thanks @chaosmasterro
In my HTML5 version, GET works perfectly but SEND doesn't send anything, despite displaying a 1 for the Callback Attribute. SEND works fine on all other platforms. Enabled CORS on my server. Any ideas?
Where is your server? Is it hosted somewhere? Some hosts just don't work
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
Ah ok. Actually using GoDaddy since I already have several hosting accounts with them. Think that might be the problem? Last year I tried a few of the others mentioned in the forums but they were more confusing. Thanks
Yes I think people have reported problems with godaddy before. I use site5, always worked
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
I'll try that, thanks for your help!
No prob. Good luck! It's always exciting when it comes together
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
I actually noticed this in the Error Log, not sure whether it's the problem or just a warning for future:
PHP Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in ........... /send.php on line 7
Tried site5. Same problem. SEND not sending anything to the db on the html5 version, despite seeing a 1 for Callback. GET works fine. SEND & GET all good in the Preview and on Android, but no use to me. Any ideas?
enable some of the logging I commented out to make sure your server is receiving the json package, it should just dump it to a txt file. also check the server logs are not showing any permissions / missing file errors
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
The json.txt and updatedjson.txt files are in the folder, the former is empty, the latter only shows the data from my tests in the GameSalad previewer. It does not display any of the info submitted in the HTML5 version.
Not sure what this means: "enable some of the logging I commented out"
Not seeing any permissions / missing file errors
I'm not 100% send/receive works in html5 versions. it's been awhile
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
Ok, receiving the data works seamlessly. 644 permissions for send.php etc?
I love that this thread is active a good few years later.... I hope everyone at GS is good.... Hi @jonmulcahy ... From Stormy...
Update: the json.txt is always empty in my File Manager when sent from the HTML5 version. Whereas it contains the correct info when sent from the Preview and Android version. Send.php code attached. Any ideas?