# Flash php mysql -DESPERATE

**URL:** <https://forum.kirupa.com/t/flash-php-mysql-desperate/176356>\
**Category:** Uncategorized\
**Created:** [January 23, 2006, 12:26pm UTC](https://forum.kirupa.com/t/flash-php-mysql-desperate/176356 "2006-01-23T12:26:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![enobynnuf](https://avatars.discourse-cdn.com/v4/letter/e/4bbf92/32.png) [@enobynnuf](https://forum.kirupa.com/u/enobynnuf)\
**Post date:** [January 23, 2006, 12:26pm UTC](https://forum.kirupa.com/t/flash-php-mysql-desperate/176356/1 "2006-01-23T12:26:14Z")

</div>

I’m trying to pass data from flash to mysql through PHP, and I managed to do it, but then i needed to do the same thing again in another file, so i copied the code and pasted it and edited it. somehow…it didn’t work!! I’ve checked and checked… Pls help me. I’m desperate!!

Here’s the sickening code… =p

ACTION SCRIPT  
 ![](http://img34.imageshack.us/img34/6480/help5km.jpg)  
on (release) {  
//checks to see if there is something in both the name  
//and password  
//if (user == “” && pass == “”) {  
//status = “One or more fields are empty please fill it in”;  
//}  
if (user == “” || pass == “” || hob == “” || sch == “”)  
{  
status = “Please fill in the required fields…”;  
}  
else  
{  
status = “Begin Login Process - Please Wait…”;  
//if you changed the php file name, change it here to!!  
myllv = new LoadVars();  
mylreply = new LoadVars();  
myllv.user = user1;  
myllv.pass = pass1;  
myllv.sch = sch;  
myllv.hob = hob;  
[//myllv.action=](https://myllv.action=)“register”;  
trace(myllv.user);  
trace(myllv.pass);  
trace(myllv.sch);  
trace(myllv.hob);  
trace(myllv.action);  
myllv.sendAndLoad(“register.php”,mylreply,“POST”);  
[//myllv.sendAndLoad](https://myllv.sendAndLoad)(“register.php”, mylreply, “GET”);  
//trace(myllv.sendAndLoad(“register.php”, mylreply, “POST”));  
mylreply.onLoad = function ()  
{  
this.val = Number(this.val);  
//\_root.userNo=Number(this.id);  
if (this.val == 1)  
{status=“You have registered successfully”;}  
else if (this.val == 0)  
{ status=“Username has already been used, Please choose another”;  
user1="";  
}  
}

}  
}

PHP

$user=$\_POST[‘user’];  
$pass=$\_POST[‘pass’];  
$hobby=$\_POST[‘hob’];  
$school=$\_POST[‘sch’];  
$j=0;  
//connect to database  
$file2= fopen(“rs2.txt”, “w”);  
fwrite($file2, $user);  
fclose($file2);  
mysql\_pconnect(“localhost”,“root”,"") or die (“didn’t connect to mysql”);  
mysql\_select\_db(“elearning”) or die (“no database”);  
//make query  
$query = “SELECT \* FROM user WHERE userName=’”.$user."’";  
$result = mysql\_query( $query ) or die (“didn’t query”);  
//test  
while($r=mysql\_fetch\_array($result))  
{  
//see if there’s an EXACT match  
$num = mysql\_num\_rows( $result );

if ($num \>0){  
//print “status=You’re in&checklog=1&id=”.$j."";  
print “val=0”;

//$file2= fopen(“rs2.txt”, “w”);  
// fwrite($file2, $printer);  
// fclose($file2);  
} else {  
$query=“INSERT INTO USER (userName,userPass,userSch,userHobby,userVal) values ($user,$pass,$school,$hobby,‘1’)”;  
mysql\_query( $query ) or die (“didn’t query”);  
print “val=1”;  
}

THANKS IN ADVANCE!
