Commit 53d12a1e authored by Srinivas's avatar Srinivas
Browse files

Update registrer3.php

parent 3f53de3d
<?php <?php
session_start(); session_start();
include('connection.php');
$connection = getdb();
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en-ca"> <html lang="en-ca">
...@@ -184,8 +187,6 @@ if($_SESSION['username4']){ ...@@ -184,8 +187,6 @@ if($_SESSION['username4']){
<table> <table>
<?php <?php
$connection = mysqli_connect("localhost","root","");
$db = mysqli_select_db($connection,'test');
if(isset($_POST['search'])) if(isset($_POST['search']))
{ {
...@@ -199,17 +200,16 @@ $password = $_POST['user_pass']; ...@@ -199,17 +200,16 @@ $password = $_POST['user_pass'];
$cpassword= $_POST['user_pass1']; $cpassword= $_POST['user_pass1'];
$HostelName = $_POST['HostelName']; $HostelName = $_POST['HostelName'];
if ($cpassword==$password){ if ($cpassword==$password){
$conn = new mysqli('localhost','root','','test'); if($connection->connect_error){
if($conn->connect_error){ die('Connection Failed : '.$connection->connect_error);
die('Connection Failed : '.$conn->connect_error);
} }
else{ else{
$stmt = $conn->prepare("insert into user_login(username,Password,HostelName) $stmt = $connection->prepare("insert into user_login(username,Password,HostelName)
values(?,?,?)"); values(?,?,?)");
$stmt->bind_param("sss",$username,$password,$HostelName); $stmt->bind_param("sss",$username,$password,$HostelName);
$stmt->execute(); $stmt->execute();
$stmt->close(); $stmt->close();
$conn->close(); $connection->close();
}echo "<script>location.href='success.php'</script>"; }echo "<script>location.href='success.php'</script>";
} }
} }
...@@ -223,4 +223,4 @@ echo "<script>location.href='3.php'</script>"; ...@@ -223,4 +223,4 @@ echo "<script>location.href='3.php'</script>";
} }
?> ?>
</body> </body>
</html> </html>
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment