Hi im having a bit of trouble getting my variables sent back to flash from php. Could someone please tell me where im going wrong. Im trying to create a simple login but im a bit new to actionscript and Iv spent hours searching forums and things. Thanks (Im using flash 8 if that helps)
This is my code
Actionscript
logins = new LoadVars();
login.onPress = function (){
logins.user = user.text
logins.password = password.text
logins.sendAndLoad(“login.php”, login2, “POST”)
};
lvOut.onLoad = function (success)
if (success) {
if (this.writing == “OK”){
gotoAndPlat(41); }
else {
gotoAndPlay(42); }
}
}
And the php script is
<?php
$user = $_POST[‘user’];
$password = $_POST[‘password’];
$conn = @mysql_connect(“localhost”,“root”,“root”)
or die(“sorry - could not connect to mysql”);
$rs = @mysql_select_db(“movies”,$conn)
or die(“problem with database”);
$query = (“SELECT * FROM customers WHERE Username = ‘$user’ AND Password = ‘$password’”);
$rs = @ mysql_query($query,$conn) or die(“unable to find records”);
if(@ mysql_num_rows($rs) == 1)
{print “writing=Ok&”;}
else
{print “writing=Error&”;}
?>