I'm trying to help a friend w/ a script that uses MySQL... We can't figure out quite how to get this to work... Are we not opening the DB connection right, or is our reference of the values of the array wrong? I thought of using mysql_error(), but I'm not sure where to put it...
TIA
<?PHP
$Host="localhost";
$Myusername="foobar";
$Mypassword="mypassword";
$Tablename="userinfo";
$DBName="foobar_1";
$Theirusername=$_GET['Theirusername']; //passed via URL
$Password=$_GET['Password']; //passed via URL
$Link=mysql_connect ($Host, $Myusername, $Mypassword);
mysql_select_db($DBName);
$Query="SELECT * FROM $Tablename WHERE ('Username'=$Theirusername)";
$Result=mysql_db_query ($DBName, $Query, $Link);
if($Result['Password'] == $Password) {
setcookie("Username", $Theirusername);
header("Location: index.php");
} Else {
include("loginform.php");
}
if($Username) {
$Result['Type']=$Type;
setcookie("Type", $Type);
$Result['Gold']=$Gold;
setcookie("Gold", $Gold);
} Else {
include("loginform.php");
}
mysql_close ($Link);
?>