Help not sure why this is happening

Okay I have been trying to work out this problem for 3 months I am not the type of person to give up but I have tried everything. I was first not able to connect to my database live with my form but I did a change from ($cxn,$sql) to ($sql,$link) since then I was able to download to phpmyadmin in Google Chrome and no other site. But in Google Chrome I get a message about global registry Warning: Unknown on line 0. all other sites give me a Warning line 116 MySql Link is ???

Here is my coding can someone help I have only been using PHP and I know someone is out there with much more knowledge than I have. This is the first page with the codes but it does not go to the second page which I will paste after this one. Any help would make my year better.
<php
@session_start();
switch (@$_POST[‘Button’])
{
case “Login1”:
include “Connections/connect_to_mysql.php”;
$sql = “SELECT id FROM Members
WHERE id= ‘$_POST[fusername]’”;
$result = mysql_query($sql)
or die(“Query died: fusername”);
$num = mysql_num_rows($result);
if($num > 0) //login name was found
{
$sql = “SELECT id FROM Members
WHERE id=’$_POST[fusername]’
AND password=md5(’$_POST[fpassword])’”;
$result2 = mysql_query($sql)
or die(“Query died: fpassword”);
$num2 = mysql_num_rows($result2);
if($num2 > 0) //password matches
{
$_SESSION[‘email1’]=“yes”;
$_SESSION[‘id’] = $_POST[‘fusername’];
$sql = “INSERT INTO Members (id,loginTime)
VALUES (’$_SESSION[id]’,NOW())”;
$result = mysql_query($sql)
or die(“Query died: insert”);
header(“Location: New_member.php”);
}
else //password does not match
{
$message_1=“The username, ‘$_POST[fusername]’ exists, but you have not entered
the correct password! Please try again.”;
$fusername=strip_tags(trim($_POST[‘fusername’]));
include(“login_form.php”);
}
}
else //username not found
{
$message_1 = “The username you entered does not exist! Please try again.”;
include(“login_form.php”);
}
break;

case “Register”:
/* Check for blanks /
foreach($_POST as $field => $value)
{
if($field != “fax”)
{
if(empty($value))
{
$blanks[] = $field;
}
else
{
$good_data[$field] = strip_tags(trim($value));
}
}
}
if(isset($blanks))
{
$message_2 = "The following fields are blank. Please enter the required information: “;
foreach($blanks as $value)
{
$message_2 .=”$value, ";
}
extract($good_data);
include(“login_form.php”);
exit();
}
/
validate data */
foreach($_POST as $field => $value)
{
if(preg_match("/name/i",$field) and
!preg_match("/user/i",$field) and
!preg_match("/log/i",$field))
{
if (!preg_match("/^[A-Za-z’ -]{1,50}$/",$value))
{
$errors[] = “$value is not a valid name. “;
}
}
if(preg_match(”/email/i”,$field))
{
if(!preg_match("/^.+@.+\…+$/",$value))
{
$errors[]="$value is not a valid email addr.";
}
}
} //end if not empty
foreach($_POST as $field => $value)
{
$$field = strip_tags(trim($value));
}
if(@is_array($errors))
{
$message_2 = “”;
foreach($errors as $value)
{
$message_2 .= $value." Please try again
";
}
include(“login_form.php”);
exit();
} // end if errors are found

/* check to see if username already exists */
include_once"Connections/connect_to_mysql.php";
$link = @mysql_connect("$db_host","$db_username","$db_pass") or die ("could not connect to mysql");
@mysql_select_db("$db_name") or die ("Query died:");
$sql = "SELECT id FROM Members
			WHERE id='$id'";
$result = mysql_query($sql)
			or die("Query died: id.");
$num = mysql_num_rows($result);
if($num > 0)
{
	$message_2 = "$id already used. Select
					another User Name.";
	include("login_form.php");
	exit();				
} // end if username already exists
else // Add new member to database
{
	$sql = "INSERT INTO Members (id,sign_up_date,username
				password,firstName,lastName,email) VALUES
				('$id',NOW(),,md5('$password'),
				'$username','$firstName','$lastName','$email')";
	mysql_query($sql);
	$_SESSION['email1']="yes";
	$_SESSION['id'] = $username;
	/* send email to new Customer */
	$emess = "You have successfully registered.	";
	$emess .= "Your new username and password are:	";
	$emess .= "\n\n\t$username\n\t";
	$emess .= "$password\n\n";
	$emess .= "We appreciate your interest. \n\n";
	$emess .= "If you have any questions or problems,";
	$emess .= " email [email protected]";
	$subj = "Your new customer registration";
	# $mailsend=mail ("$email","$subj","$emess");
				
}
break;

default:
	include("login_form.php");

}
?>
<php
session_start();

if (@$_SESSION[‘auth’] != “yes”)
{
header(“Location: login.php”);
exit();
include(“dogs.inc”);
$link = mysqli_connect($host,$user,$password,$dbname)
or die(“Couldn’t connect to server.”);
$sql = “SELECT firstName, lastName FROM Members
WHERE id=’{$_SESSION[‘id’]}’”;
$result = mysqli_query($sql,$link)
or die(“Couldn’t execute query”);
$row = mysqli_fetch_assoc($result);
extract($row);
}
echo "
New Member Welcome


Welcome $firstName

\n";
?>

Your new Member accounts lets you enter the members only section of our web site. You'll find special discounts, a profile of matches, live advise for experts, and much more.

Your new Member ID and password were emailed to you. Store them carefully for future use.

Glad you could join us!

In the very first line of your code you have incorrect php opening tag <php correct is <?php

Sound like you are having problem working with database… but in your code you have many included files, that have code too. Try to start with simple example, and once you get it working with database, you’ll be able to correct code in your application. Check this example to see how you can: create MySQL database and table, connect to a database, insert records to a table.

Sponsor our Newsletter | Privacy Policy | Terms of Service