database
Hello Can you help me I want to connect my
Here is the error:
Warning: Undefined array key "fname" in C:\xampp\htdocs\VaccinationSystem\adduser.php on line 10
Warning: Undefined array key "mname" in C:\xampp\htdocs\VaccinationSystem\adduser.php on line 11
Warning: Undefined array key "gender" in C:\xampp\htdocs\VaccinationSystem\adduser.php on line 12
Can't Insert Data : Column count doesn't match value count at row 1
And here is my code
<?php
session_start();
include 'database_connection.php';
if($_POST['uname'] && $_POST['password'])
{
$name=$_POST['uname'];
$lname = $_POST['lname'];
$gen = $_POST['gender'];
$city = $_POST['city'];
$birth = $_POST['birth'];
$type = $_POST['utype'];
$email = $_POST['email'];
$pass=$_POST['password'];
if($type=='Admin')
admin($name,$lname,$gen,$city,$birth,$email,$pass,$con);
else
parent($name,$lname,$gen,$city,$birth,$email,$pass,$con);
}
function admin($name,$lname,$gen,$city,$birth,$email,$pass,$con)
{
$query="INSERT INTO admin VALUES('$name','$lname','$gen','$city','$birth','$email','$pass')";
$result=mysqli_query($con,$query);
if(!$result)
{
die("<br>Can't Insert Data : " .mysqli_error());
}
echo "<script>alert('Admin Record Inserted..!!');window.location='index.php'</script>";
}
function parent($name,$lname,$gen,$city,$birth,$email,$pass,$con)
{
$query="INSERT INTO parent VALUES('$name','$lname','$gen','$city','$birth','$email','$pass')";
$result=mysqli_query($con,$query);
if(!$result)
{
die("<br>Can't Insert Data : " .mysqli_error());
}
echo "<script>alert('Parent Record Inserted..!!');window.location='index.php'</script>";
}
?>
Step by step
Solved in 2 steps with 1 images