OK, I have a php script that queries an sql database for a user defined email address. The script works great when using the html form I created to test the script. However, using flash to run the script, I only get a “true” response back to flash if the I leave the input field blank.
Here is the test links to try it out for your self, I will also post the code I have. Ignore the other 2 feilds in the flash file. I was using them to see where and what data was actually being passed through my PHP script.
HTML sample that works:
http://209.61.249.82/form.php
Flash movie that does not work right. Send an empty var and you get true. But when you send test@test.com you get false but it should be true. It works with the html form:
http://209.61.249.82/get.html
Here is the flash script:
button.onPress = function ()
{ loadVariablesNum ("test.php", 0, "POST");};
Here is the PHP code:
<?php
$in_mail = $_POST['email'];
// Formulate Query
$query = sprintf("SELECT * FROM `dcg_customer` WHERE `email`='$in_mail'");
// Perform Query
$result = mysql_query($query);
// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . "
";
$message .= 'Whole query: ' . $query;
die($message);
}
else {
$row = mysql_fetch_assoc($result);
$data = $row["email"];
}
if ($in_mail==$data){
$create="true";
echo "&read=$create";
}
else { $create="false";
echo "&read=$create";}
// Free the resources associated with the result set
// This is done automatically at the end of the script
mysql_free_result($result);
?>
Any help would be greatly appreciated!
Thanks,
The newguy