Hi guys, im new to all this PHP stuff, and am currently pulling my hair out with my problem.
I have a uni assignment that I am doing in Flash MX 2004, all run locally on a machine and not via the web. I have recently installed PHP, Apache, MySQL and Navcat MySQL free trial.
My database was created in Navcat MySQL, GUI based.
I have a simple form in Flash, with Username input and password input. The submit button has the ActionScript as follows...
on (release, keyPress "<Enter>") {
if (user != "" && pass != "") {
status = "Wait...";
loadVariablesNum("newlogin.php", 0, "POST");
}
}
This code, im sure, is correct...
My PHP file contains the following...
<?
$user=$_POST['user'];
$pass=$_POST['pass'];
//connect to database
if ($user && $pass){
mysql_pconnect("mysql.localhost","root","") or die ("didn't connect to mysql");
mysql_select_db("tester") or die ("no database");
//make query
$query = "SELECT * FROM userpass WHERE username = '$user' AND password = '$pass'";
$result = mysql_query( $query ) or die ("didn't query");
//see if there's an EXACT match
$num = mysql_num_rows( $result );
if ($num == 1){
print "status=You're in&checklog=1";
} else {
print "status=Sorry, but your user name and password did not match a user name/password combination in our database. Usernames and passwords are entered in from a different file. Thank you for visiting test login script!!&checklog=2";
}
}
?>
Im not sure if the 'mysql.localhost' is correct, this should be my host name, which I am not sure of, but all other information is correct, database name, table name, and field names, but I just cant get it to do anything. PLEASE HELP, im clueless
Using Flash MX 2004, PHP and MySQL to connect to a database
Moderator: General Moderators
- stereofrog
- Forum Contributor
- Posts: 386
- Joined: Mon Dec 04, 2006 6:10 am