# Where I'm doing wrong?

**URL:** <https://forum.kirupa.com/t/where-im-doing-wrong/274834>\
**Category:** flash\
**Created:** [November 5, 2008, 3:38pm UTC](https://forum.kirupa.com/t/where-im-doing-wrong/274834 "2008-11-05T15:38:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![White\_wizard](https://avatars.discourse-cdn.com/v4/letter/w/dbc845/32.png) [@White\_wizard](https://forum.kirupa.com/u/White_wizard)\
**Post date:** [November 5, 2008, 3:38pm UTC](https://forum.kirupa.com/t/where-im-doing-wrong/274834/1 "2008-11-05T15:38:42Z")

</div>

Hi. I’m making login thing with flash using amfphp to use my mysql database.

AS3 code:

import [flash.net](http://flash.net).\*;

var gw:NetConnection = new NetConnection();  
gw.connect(“[http://localhost/df/game/amfphp/gateway.php](http://localhost/df/game/amfphp/gateway.php)”);

var res:Responder = new Responder(onResult, onFault);

function onResult(responds:Object):void {  
trace (responds);  
}

function onFault(responds:Object):void {  
for (var i in responds) {  
trace (responds\*);  
}  
}

gw.call(“Login.loginCheck”, res, “Username” , “password”);

PHP in services folder:  
\<?php  
class Login {  
/\*\*  
\*This service checks login

- @returns true or false  
\*/  
public function \_\_construct() {  
mysql\_connect(“localhost”, “username”, “password”);  
mysql\_select\_db(“dbname”);

}  
function login($userName, $passWord) {

$query = “SELECT \* FROM users WHERE username= '”.$userName."’");  
$result = mysql\_query($query);  
$row = mysql\_fetch\_assoc($result);  
if ($row[‘password’] != $passWord){  
return “false”;  
break;  
} else {  
return “true”;  
}  
mysql\_close();

}  
}

Output:  
Error #2044: Unhandled NetStatusEvent:. level=error, code=NetConnection.Call.BadVersion  
at email\_fla::MainTimeline/frame1()

And if I just put into loginCheck function return “true” and delete the query thing I get to output text true.

So where I’m doing wrong?

Ps. Reason why I use string type to return true is that I heard that php boolean doesn’t work so well in actionscript and I also need to create sessions with php later. Login is for my multiplayer game with flash.

Thanks for advance.
