Code:
?php
session_start();
$connection=mysqli_connect("localhost","root","root","") or die("Error Connecting to Database");
//$db = mysql_select_db("database") or die("Error Selecting Database");
if (!$connection) //if not connection
{
echo "could not connect";
}
else
{ //authenticate inputs
if (isset($_POST['submit']))
{
$tit=$_POST['tittle'];
$sname=$_POST['surname'];
$onames=$_POST['othernames'];
$uname=$_POST['username'];
$pword=$_POST['password'];
$query="INSERT INTO `sear` VALUES (NULL, '$tit', '$sname','$onames','$uname', '$pword')";
$result=$connection->query($query) or die("Error Uploading to Datatbase");
if ($result)
{
$query="SELECT * FROM `staff` WHERE `username`='$username' AND `password`='$password'";
$result=$connection->query($query);
if ($result)
{
$resultArray=$result->fetch_assoc();
$username=$resultArray['username'];
$password=$resultArray['password'];
echo $username;
$query="INSERT INTO `admia` VALUES (NULL,'$username', '$password')";
$result=$connection->query($query);
if ($result)
{
echo "</br>";
echo "acccount was successfully created";
}
}
}
// else
// {
// header ('Location:register-staff.php?Message=0');
// }
} //$username=$_SESSION['username'];
}
?>
Comment