PHP - MySQL Query not working
<mx:RemoteObject id="zendAMF" destination="zend" showBusyCursor="true" source="test_class" >
<mx:method name="doLogin" result="onSayHelloResult(event)">
<mx:arguments>
<username>
{username.text}
</username>
<password>
{password.text}
</password>
</mx:arguments>
</mx:method>
</mx:RemoteObject>
This is my Flex code, I am not using POST ....
I'm not sure if I will return, I always get the return value even though I enter the correct username and password.
Can anyone help me.
a source to share
You have to write the line
$result = mysql_fetch_array(mysql_query($query));
and
$res = mysql_query($query);
if (!$res) {
die "doLogin: " . mysql_error();
}
$user = mysql_fetch_array($res);
at least when testing this code. This way you can see if there are any errors in your database.
a source to share
This will be an HTML problem more than a request problem, since the only thing this class will return 'no' is your $ _POST variables.
Hopefully the basics of your form should look something like this in HTML:
<form method='post' action='filename.php'>
<input type='text' name='username' /><br />
<input type='password' name='password' />
</form>
a source to share
Are you sure you are not storing hashed passwords?
Also, don't use this ugly function, use related parameters. It's cleaner and better.
Update:
no
is returned whenever the following condition is met:
if (isset($_POST['username']) && isset($_POST['password']))
no matter what happens in MySQL
.
Make sure you set both variables.
a source to share