AS2 - problem with inserting of partition/name of the database/mysql

Hello

First of all... Sorry that I havn't put the ACE in a box, do not know how to do it on this forum!

Okay, so here's my problem:

I want to submit my score and the name in my database.

This is the script I've tried Flash.

Stop();

create objects loadVars

playerx = new LoadVars();

playerRegistered = new LoadVars();

playerRegistered.onLoad = showResult;

create the button handler code to call the function that sends & load php

_root.submitt.onRelease = submitScore;

function submitScore (): Void {}

playerx. Name = name_txt.text;

playerx.score = score_txt.text;

playerx.sendAndLoad ("register.php", playerRegistered);

}

This is the PHP script:

<? PHP

$connect = mysql_connect('x.com.mysql','x','password');

@mysql_select_db ('x', $connect);

$sql = "INSERT INTO high_scores_avoidthecars (name, score) VALUES ("'. ")" $_POST ['name']. '"," '. $_POST ['score'].'") ';"

? >

Nothing is posted to the database, no errors etc... any ideas?

If you went thru the link I provided you should see where you need to change the code that you did to get the Flash to work code.  Here is a link to an example of work that takes into account the second part of the code in this link that involves sending data (from line 28) with your textfields, etc.

http://www.nedwebs.com/Flash/register.html

The main problem with your AS2 code involves the following line...

playerx.sendAndLoad ("register.php");

It should be...

playerx.sendAndLoad ("register.php", playerx. 'POST');

Here's the code I used for the example files, I did...

AS2 CODE

playerx = new LoadVars();

_root.submitt.onRelease = submitScore;

function submitScore (): Void {}

Response.Text = "clicked\n";

playerx. Name = name_txt.text;

playerx.score = score_txt.text;

playerx.sendAndLoad ("register.php", playerx, "POST");

}

playerx.onLoad = onLoadCallBack;

function onLoadCallBack (success)
{
Response.Text += "onLoad Processed\n";

{if (success)}
Response.Text += "Success\n;
Response.Text += this.lVar1 + "\n";
Response.Text += this.lVar2;
} else {}
Response.Text = "load error".
}
}

PHP CODE

<>
read the variables
$var1 = $_POST ['name'];
$var2 = $_POST ['mark'];

Send variables
echo "& lVar1 = $var1 return &";.
echo "& lVar2 = $var2 returned as well &";.
?>

Tags: Adobe Animate

Similar Questions

Maybe you are looking for

  • My RSS reader captures all of my favorites

    My RSS reader (in a nutshell) does not pick up all my feeds. specifically, it does not pick up those with dotted square instead of logos in the label box. that means these squares, and how repair my drive to pick up? Thank you. Roger Blair

  • iaStor.sys BSOD on my new satellite U series

    Hello. All of a sudden without any update, or a new program installation, my laptop start BSOD (BSOD iaStor.sys & iaStorA.sys) and restart...* Both on safe mode and normal mode.* I try the last known good configuration, but nothing.* I also tried to

  • Re: How to enable/disable the module BT on Satellite A300?

    I have Toshiba Satellite A300 - 1 MM.When I try to connect to my Wi - Fi network NOW I have to ACTIVATE the switch, on the front of my laptop and all works well, but peripheral, Bluetooth is enabled. I would like to disable the Bluetooth and works wi

  • CBK55F2K price

    I just received the price for this filter to the United Kingdom as GBP 585 + taxes. How does this compare to other countries?

  • HP ENVY m6-k010dx fn key locked

    I have a HP Envy m6-k010dx and it seems that the fn button is locked. Whenever I hit the volume buttons or brightness that it's as if I was now pressed the key fn as well. Does anyone know how to fix this?