Something's wrong with my code when saving an item. I not sure what is wrong. Can someone please help!!!! I'm new to this.
PHP:
<?php
mysql_connect("host","user","pass") or die();
mysql_select_db("database name") or print "word=Failed.&checklog=2";;
$usercheck = $_POST['username'];
$result = mysql_query("UPDATE users SET Color = '1' WHERE username='$usercheck' ");
if (!$result) {
die('Invalid query: ' . mysql_error());
}
Flash:
on (release) {
var newCol = 9;
_root.smartfox.setUserVariables({col:newCol, init:true});
_root.myAvatar.disc.gotoAndStop(newCol);
_root.whatColor = 9;
if (_root.username != "") {
loadVariablesNum("itemsave.php", 0, "POST");
_root.word = "Begin saving process";
}else{
_root.word = "Error";
}
_root.closeColor();
}
Also tested the MySQL by updating a user and it worked (Using the code, UPDATE users SET Color = '1' WHERE username='Test')
Thanks.
Help with saving a color
-
- Posts: 6
- Joined: 08 Oct 2011, 15:11
Re: Help with saving a color
Hi there,
It seems you aren't sending the necessary variables to the php file.
I'd suggest you to use the LoadVars class instead of using the loadVariablesNum method.
On the LoadVars class you have a send() method (if you only want to send data to php, but don't need to retrieve anything from it) and a sendAndLoad() method (which sends data and then downloads the response from the php).
For your scenario, it seems the send() method is enough.
For more information you can check here:
http://stackoverflow.com/questions/1739 ... lue-to-php
Hope this helps
It seems you aren't sending the necessary variables to the php file.
I'd suggest you to use the LoadVars class instead of using the loadVariablesNum method.
On the LoadVars class you have a send() method (if you only want to send data to php, but don't need to retrieve anything from it) and a sendAndLoad() method (which sends data and then downloads the response from the php).
For your scenario, it seems the send() method is enough.
For more information you can check here:
http://stackoverflow.com/questions/1739 ... lue-to-php
Hope this helps
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
-
- Posts: 6
- Joined: 08 Oct 2011, 15:11
Re: Help with saving a color
Thanks rjgtav!
Return to “SmartFoxServer 1.x Discussions and Help”
Who is online
Users browsing this forum: No registered users and 81 guests