Jump to content

Notice: Undefined variable: con in F:\xampp\htdocs\l.php on line 223 Warning: mysql_close() expects parameter 1 to be resource


dean012

Recommended Posts

Notice: Undefined variablearrow-10x10.png: con in F:\xampp\htdocs\l.php on line 223

Warning: mysql_close() expectsarrow-10x10.png parameter 1 to be resource, null given in F:\xampp\htdocs\l.php on line 223

<?php
ini_set('session.use_only_cookies',1);
session_start();
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
 
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Yakity Yak</title>
<link href='http://fonts.googlea...=Oswald:400,300' rel='stylesheet' type='text/css'>
<link href='http://fonts.googlea...css?family=Abel|Satisfy' rel='stylesheet' type='text/css'>
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<div id="wrapper">
 
  <p><!-- end #header --></p>
  <div id="header" class="container">
    <div id="logo">
      <h1><a href="#">Yakity Yak</a></h1>
    </div>
    <div id="menu">
      <ul>
        <li class="current_page_item"><a href="homepage.php">Homepage</a></li>
        <li><a href="trip.php">Destinations</a></li>
        <li><a href="contact.php">contact </a></li>
        <li><a href="login1.php">Login</a></li>
		<li><a href="adminlogin.php">Leader</a></li>
        <li></li>
        <li></li>
      </ul>
    </div>
  </div>
  <blockquote>
    <blockquote>
      <p> <center><img src="sd.jpg" width="999" height="300"  alt=""/></center>  </p>
    </blockquote>
  </blockquote>
  <div id="page">
    <div class="post">
      
<!--Introduction Paragraph-->
<?php
$host = "localhost";
$user = "root";
$pass = "";
$db = "kayaks_club";



// VALUES ('$_POST[User_ID]', '".$trip_ID."', $_POST[surname]', '".$trip."', '".$difficulty."', '".$when."', '".$cost."')";

$name = $_POST['firstname']. ' '. $_POST['surname'];
$firstname = $_POST['firstname'];
$surname = $_POST ['surname'];
$age = $_POST['age'];
//$gender = $_POST['gender'];
$number = $_POST['number'];
$email = $_POST['email'];
$password = $_POST['password'];
$confirmpassword = $_POST['confirmpassword'];



//Setting up an array of all the possible errors
$errors = array();{
//If inputed varaible is NOT empty then assign it a value EMAIL
    if(!empty($_POST)) { 
        $email = $_POST['email'];		
		
//If inputed varaible IS empty then, then a FIRSTNAME needs to be entered
		if (empty($_POST['firstname']) or is_numeric($_POST['firstname'])){
		$errors [] = 'Please enter a valid Firstname.';
		}
//Otherwise if Firstname is longer than 25 "name is too long"
		elseif(strlen($_POST['firstname']) > 25)	{ 
        $errors[] = "Name is too long";
		}
//If a value has been inputed and is less than 25 characters then assign it to FIRSTNAME
		else{
		$firstname = $_POST['firstname'];
        }
//If inputed varaible is NOT empty then assign it a value SURNAME
		if (!empty($_POST['surname']) and !is_numeric($_POST['surname'])){
		$surname = $_POST['surname'];
		}
//Othwrwise if it is empty, then "A surname must be entered"
		else{
		$errors [] = 'Please Enter a valid Surname.';
		}
		
		
//If inputed varaible is NOT empty and is a number then assign it a value AGE                                     
		if (!empty($_POST['age']) and is_numeric($_POST['age']))  {
		$age = $_POST['age'];
		}
//Othwrwise if it is empty, then "A valid age must be entered"
		else{
		$errors [] = 'Please Enter a valid age.';
		}
		

//If inputed varaible is NOT empty then assign it a value GENDER
		if (!empty($_POST['gender'])){
		$gender = $_POST['gender'];
		}
		
//Othwrwise if it is empty, then "A Gender must be selected"
		else{
		$errors [] = 'Please Select a Gender.';
		}
		
//If inputed varaible is NOT empty and is a number then assign it a value NUMBER                                     
		if (!empty($_POST['number']) and is_numeric($_POST['number']))  {
		$number = $_POST['number'];
		}
//Othwrwise if it is empty, then "A valid age must be entered"
		else{
		$errors [] = 'Please Enter a valid Telephone Number.';
		}		

//If inputed varaible is NOT empty then assign it a value PASSWORD
		if (!empty($_POST['password']) and ($_POST['password']) == ($_POST['confirmpassword'])) {
		$pasword = $_POST['password'];
		}
//Othwrwise if it is empty or dont match, then "A valid password must be entered and must match"
		else{
		$errors [] = 'A valid password must be entered and both fields must match.';
		}
		
//To check if the email entered is a valid email address				
        if(filter_var($email, FILTER_VALIDATE_EMAIL) === false) {
            $errors[] = "Please enter a valid email address.";
        }
					
	if(!empty($errors)){
	print_r($errors);
	echo " Click your Browser back button to go back.";
	}
	else{
	//Connect to database server
		$con=mysqli_connect('localhost','root','','kayaks_club');
// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }
//Which Table and cell to insert the new information
$sql= "INSERT INTO users (firstname, surname, age, gender, number, email, password)

 VALUES ('$_POST[firstname]', '$_POST[surname]', '$_POST[age]', '$_POST[gender]', '$_POST[number]', '$_POST[email]', '$_POST[password]')";
 
 
 
 
 

  if (!mysqli_query($con,$sql)) 
  {
  die('Error: ' . mysqli_error($con));
  }


//mysqli_close($con);



echo '<h1> Registration succecfull!</h1><br/><br/>';
echo 'Hello '. $name . '. Thank you for Registering With Canoe & Kayak Club.<br />';
echo 'You can now log in to view to  find out the trip information.<br/>';



$query = "SELECT * 
FROM `users` 
WHERE `Surname` LIKE 'King'
LIMIT 0 , 30";

/*SELECT * 
FROM  `kayaks_club`.`users` 
WHERE (
CONVERT(  `User_ID` 
USING utf8 ) LIKE  '".$surname."'
OR CONVERT(  `Trip_ID` 
USING utf8 ) LIKE  '".$surname."'
OR CONVERT(  `Surname` 
USING utf8 ) LIKE  '".$surname."'
OR CONVERT(  `Trip` 
USING utf8 ) LIKE  '".$surname."'
OR CONVERT(  `Difficulty` 
USING utf8 ) LIKE  '".$surname."'
OR CONVERT(  `When` 
USING utf8 ) LIKE  '".$surname."'
)
LIMIT 0 , 30*/


//Result = the query
$result = mysql_query($query) or die (mysql_error());
if(!mysql_affected_rows() >= 1)
{
echo 'You Have not signed up for any trips. Please go to the "Join A Trip" page under the "Home" tab ';
}
while($row = mysqli_fetch_array($result))
{

//Display this in a table
echo '<tr>';
echo '<td>'. $row['User_ID'].'</td>';
echo '<td>'. $row['Firstname'].'</td>';
echo '<td>'. $row['Surname'].'</td>';
echo '<td>'. $row['Age'].'</td>';
echo '<td>'. $row['Password'].'</td>';
'</centre>';
}
echo '</table>';
	}
	}
	}
	
mysql_close($con);

 ?>

</div>
<div id ="footer">
<a href="Admin_Index.html"><br/>The Wellington Canoe & Kayak</a><br/>PO Box 23456<br/>Wellington<br/>Telephone:04 4776911<br/>Email: wellington@canoeandkayak.co.nz<br/>
</div>
</div>
</div>






</body>
</html>
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.