Search code examples
phpmysqlapache-flexposthttpservice

HTTPService & MySQL & PHP


I can't seem to post needed information to my database, here's what I've got:

<mx:HTTPService id="someService" url="http://name.domain/postPHP.php" method="POST">
    <s:request xmlns="">
            <name>{name.text}</name>
            <score>{score.text}</score>
    </s:request>
</mx:HTTPService>

And of course a button to send();

Php as follows:

echo "<?xml version=\"1.0\" ?>\n;

$connections = ...;
mysql_select_db("...");

$name = $_POST['name'];
$score = $_POST['score'];

$query = "INSERT INTO hs (name, score) VALUES ('$name', '$score')"; 
mysql_query($query);

So what is wrong? Why ain't it adding the information to my database?

Thanks, Yan


Solution

  • Missing a " at the end of the first line:

    echo "<?xml version=\"1.0\" ?>\n";
    
    $connections = ...;
    mysql_select_db("...");
    
    $name = $_POST['name'];
    $score = $_POST['score'];
    
    $query = "INSERT INTO hs (name, score) VALUES ('$name', '$score')"; 
    mysql_query($query);