Jump to content

issue with how the value not being checked. I am baffled why


hansolo
 Share

Recommended Posts

These are the values returned and the response in fire bug. i can see the value has been returned what i am checking for in the browser and flash with a trace command. The if statement in flash to check the value of "&character" which does have the value of "tomb" This if statement which is true is not getting checked I can see this becuase does not get played trace("this a success found tomb")these the value loaded in the browser below. php return values in firebug&userName=ben&character=tomb flash code var result_lv:LoadVars = new LoadVars(); result_lv.onLoad = function(ok){ if (ok) { trace(result_lv.character); if( result_lv.character== "tomb"){ trace("this a success found tomb") } } } send_lv= new LoadVars(); trace(this._name + "pressed"); send_lv.username = "ben" ; send_lv.sendAndLoad("http://localhost/check4.php",result_lv,"POST");

Link to comment
Share on other sites

below is my php codeThese are the values returned in the browser &userName=ben&character=tombso why does this value not return true if( result_lv.character== "tomb"){trace("this a success found tomb") <?php$con = mysql_connect("localhost","root","") or die();mysql_select_db("users_db") or die();// post username here//$user = $_POST['username'];$user = "ben";$table = "username_tbl";$value =3;//$check = mysql_query("SELECT * FROM $table WHERE username = '$user'//")or die();$check2 = mysql_num_rows($check);if ($check2 == 0) {echo"&reply=incorrect username or passwrd";die();}// this value can only be passed if the value is in the databaseif ($check2 == 1) {$selection = mysql_query("SELECT character_col FROM $table WHERE username = '$user'");echo"&tests=".$value;while($row = mysql_fetch_array($selection)) { $hold = $row['character_col']; } } if($hold == "tomb"){ //echo"winner"; echo"&tombRaider="."1"; }else{ echo"loser"; }mysql_close($con);?>

Link to comment
Share on other sites

no i expect it trace in flash. The variable are loading in both firebug and flash however The if statement created in flash is not tracing .so im unable to use this loaded variable in flash.I dont know why . Im confuse.liike you say this shouldnt have an issue . I must bedoing something incorrect if( result_lv.character== "tomb"){trace("this a success found tomb")}

Link to comment
Share on other sites

ys i think ive got an idea why not running its not getting played in the php code. Even though loading in the browser.. I m gonna simplfy itas i only need to get the data from the character column. I probaly should run mysql query once rather than twice. I try that anyway as the above is not working

Link to comment
Share on other sites

In the onLoad function, trace the ok and character variables to see what they are set to. Don't put them in if statements, just trace them to see what they are. ok i think i have done that but i post them to what they are set to this does return the value of 1 i guess they set to result_lvtrace(result_lv.tombRaider);

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...