Np Ms Office 365/Excel 2016 I Ntermed
1st Edition
ISBN:9781337508841
Author:Carey
Publisher:Carey
Chapter7: Developing An Excel Application
Section: Chapter Questions
Problem 4.7CP
icon
Related questions
Question

Hello Can you help me I want to connect my database and table name admin on my PHP code but it throw some error I did not commit any sql query I just create table but it does not have function. Can you help me to create a proper table with the info below.

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>";
    }

?>

DServer. 127.0.0.1 » ODatabase: vaccination »
Table: admin
E Browse
A Structure
I SQL
Search
3i Insert
E Export
2 Import
E Privileges
Operations
O Tracking
E Triggers
A Table structure
E Relation view
# Name
Туре
Collation
Attributes Null Default Comments Extra Action
1 username
varchar(100) latin1_swedish_ci
No None
2 Change
Drop v More
2 lastname
varchar(100) latin1_swedish_ci
Yes NULL
2 Change
Drop - More
3 firstname
varchar(100) latin1_swedish_ci
Yes NULL
O Change
Drop - More
4 middlename varchar(100) latin1_swedish_ci
Yes NULL
Change
Drop - More
O 5 gender
varchar(8)
latin1_swedish_ci
No None
O Change
Drop v More
6 birth
date
Yes NULL
O Change
Drop
v More
O 7 category
varchar(100) latin1_swedish_ci
Yes NULL
O Change
Drop - More
8 email
varchar(500) latin1_swedish_ci
Yes NULL
O Change
Drop - More
O 9 pass
varchar(500) latin1_swedish_ci
Yes NULL
O Change
Drop v More
O Check all
With selected:
I Browse
O Change
O Drop
O Primary
U Unique
個Index
Is Spatial
T Fulltext
Add to central columns
A Remove from central columns
Transcribed Image Text:DServer. 127.0.0.1 » ODatabase: vaccination » Table: admin E Browse A Structure I SQL Search 3i Insert E Export 2 Import E Privileges Operations O Tracking E Triggers A Table structure E Relation view # Name Туре Collation Attributes Null Default Comments Extra Action 1 username varchar(100) latin1_swedish_ci No None 2 Change Drop v More 2 lastname varchar(100) latin1_swedish_ci Yes NULL 2 Change Drop - More 3 firstname varchar(100) latin1_swedish_ci Yes NULL O Change Drop - More 4 middlename varchar(100) latin1_swedish_ci Yes NULL Change Drop - More O 5 gender varchar(8) latin1_swedish_ci No None O Change Drop v More 6 birth date Yes NULL O Change Drop v More O 7 category varchar(100) latin1_swedish_ci Yes NULL O Change Drop - More 8 email varchar(500) latin1_swedish_ci Yes NULL O Change Drop - More O 9 pass varchar(500) latin1_swedish_ci Yes NULL O Change Drop v More O Check all With selected: I Browse O Change O Drop O Primary U Unique 個Index Is Spatial T Fulltext Add to central columns A Remove from central columns
Vaccination Management
Username
Enter Username
Last Name
Enter Last Name
First Name
Enter First Name
Middle Name*
Enter Middle Name
Gender
O Male o Female
Birth Date *
dd/ nn/ yyy
You are a"
Select an Option
Email Address"
Enter email address
Password"
Enter Password
Register
Already have an Account? Login
Transcribed Image Text:Vaccination Management Username Enter Username Last Name Enter Last Name First Name Enter First Name Middle Name* Enter Middle Name Gender O Male o Female Birth Date * dd/ nn/ yyy You are a" Select an Option Email Address" Enter email address Password" Enter Password Register Already have an Account? Login
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Hyperlinks
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Oracle 12c: SQL
Oracle 12c: SQL
Computer Science
ISBN:
9781305251038
Author:
Joan Casteel
Publisher:
Cengage Learning
Enhanced Discovering Computers 2017 (Shelly Cashm…
Enhanced Discovering Computers 2017 (Shelly Cashm…
Computer Science
ISBN:
9781305657458
Author:
Misty E. Vermaat, Susan L. Sebok, Steven M. Freund, Mark Frydenberg, Jennifer T. Campbell
Publisher:
Cengage Learning