So, here is the question. I have a small flash application that sends some variables to a php script (via POST), and that php script sends them to a mySQL database.
This works fine when I'm testing my flash offline, I go to phpmyadmin, and the registry is done. When I upload the swf to a online html, this stops working. It no longer creates another registry in the database. I have no ideia why this happens.
I read a bit about it and found out about cross domain policy, and thought it might be the problem. Thus I made a small .xml file and uploaded it to both servers (the one the swf is on, and the one that has the database), and its still not working.
Here is my crossdomain.xml file (named that way):
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" />
</cross-domain-policy>
And the php (named insert.php), that is on the same server as the database:
<?php
//connect to the local MySQL
$connect=mysql_connect("localhost", "DBName", "DBPass");
//select your database
mysql_select_db("DBTable");
//query the database
$query="INSERT INTO results(Nome,Email,Idade,Profissao,Pais)
VALUES
('$_POST[nome]','$_POST[email]','$_POST[idade]','$_POST[profissao]','$_POST[pais]')";
//$result=mysql_query($query);
if (!mysql_query($query,$connect))
{
die('Error: ' . mysql_error());
echo "InsertOk=NotOk";
}else{
echo "InsertOk=Ok";
}
mysql_close($connect)
?>
Thank you! Marco Roberto