# FMX2004 \> PHP \> MySQL \> PHP \> FMX2004

**URL:** <https://forum.kirupa.com/t/fmx2004-php-mysql-php-fmx2004/97096>\
**Category:** Uncategorized\
**Created:** [December 17, 2003, 6:35pm UTC](https://forum.kirupa.com/t/fmx2004-php-mysql-php-fmx2004/97096 "2003-12-17T18:35:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ScriptFlipper](https://avatars.discourse-cdn.com/v4/letter/s/a6a055/32.png) [@ScriptFlipper](https://forum.kirupa.com/u/ScriptFlipper)\
**Post date:** [December 17, 2003, 6:35pm UTC](https://forum.kirupa.com/t/fmx2004-php-mysql-php-fmx2004/97096/1 "2003-12-17T18:35:35Z")

</div>

I don’t get it to work !!! :red: (of course/as usual)

I have a Flash-app.  
I send vars from it to PHP. (works)  
PHP stores in MySQL DB. (works)  
PHP sends back to Flash for user verification. (DON’T WORK!)

Can someone with a sulotion help me out on this problem.  
PLEASE!!!  
Tanks in advance  
/Kalliban (super-junior on this thing…)

Action-script for Frame 1:  
[AS]  
stop();

/// declare LoadVars to send to PHP  
abc = new LoadVars();

/// declare LoadVars to recieve from PHP  
recieved = new LoadVars();

/// sendAndLoad-function  
function dataSAL() {  
abc.sendAndLoad(“save.php”, recieved, “POST”);  
abc.onLoad = dataRec(true);  
}

/// data recieved=true function  
function dataRec(success) {  
if (success) {  
nextFrame();  
} else {  
trace(“Failed!”);  
}  
}  
[/AS]

AS for textinput “textXYZ”  
[AS]  
on (change) {  
\_root.abc.xyz = this.text;  
}  
[/AS]

AS for button  
[AS]  
on (click) {  
/// Load the sendAndLoad-function  
\_root.dataSAL();  
}  
[/AS]

AS for Frame 2  
[AS]  
stop();  
/// displaying the text recieved from PHP in the textarea  
txtRecieved.text = recieved.xyz;  
[/AS]

PHP-file save.php:

```php

<?php
$text=$_POST['xyz'];

if ($text){
	$connect = mysql_connect("localhost","root","12345") or die("MySQL-connection error.");
	mysql_select_db("test") or die("MySQL-database error.");

	$query = "INSERT INTO t (text) VALUES ('$text')";
	$result = mysql_query($query) or die("MySQL-INSERT error.");
	
	$query = "SELECT * FROM t WHERE text='$text'";
	$result = mysql_query($query) or die("MySQL-SELECT error.");
	$row=mysql_fetch_row($query);
	print("xyz=".$row[0].");
	
	mysql_close($connect);
}
?>

```
