0

I have searched for a reason I am receiving a "column not found" error, but my tired eyes cannot find it. I would also like to know what Array ( [0] => 00000 1 => [2] => ) means exactly.

Revised

PHP

<?php
require_once('dbconnect.php');
function AddNewAccount() {
    //var_dump($_POST); exit;
    try {
        $acctType = $_POST["user-type"];
        if (!isset($acctType) || empty(trim($acctType))) {
            throw new Exception('You must select an account type.');       
        };
        $name = $_POST["name"];
        if (!isset($name) || empty(trim($name))) {
            throw new Exception('You must enter your name.');       
        };
        $company = $_POST["company"];
        if (!isset($company) || empty(trim($company))) {
            throw new Exception('You must enter your company name.');       
        };
        $street = $_POST["address"];
        if (!isset($street) || empty(trim($street))) {
            throw new Exception('You must enter your street address.');       
        };
        $city= $_POST["city"];
        if (!isset($city) || empty(trim($city))) {
            throw new Exception('You must enter your city.');       
        };
        $state = $_POST["state"];
        if (!isset($state) || empty(trim($state))) {
            throw new Exception('You must enter your state.');       
        };
        $zipcode = $_POST["zip"];
        if (!isset($zipcode) || empty(trim($zipcode))) {
            throw new Exception('You must enter your zipcode.');       
        };
        $email = $_POST["email"];
        if (!isset($email) || empty(trim($email))) {
            throw new Exception('You must enter your email.');       
        };
        $password = $_POST["pwd"];
        if (!isset($password) || empty(trim($password))) {
            throw new Exception('You must enter your password.');       
        } else
        $password=crypt($passwword);

        $dbh = connect2DB();
        $stmt = $dbh->prepare('INSERT INTO Accounts(UserType, `name`, Company, StreetAddress, City, State, Zipcode, Email, Password) 
                               VALUES($acctType, $Name, $company, $street, $city, $state, $zipcode, $email, $password)');
        if (!$stmt->execute()) {
            echo "\nPDOStatement::errorCode(): ";
            print $stmt->errorCode();
            print_r($dbh->errorInfo());
        } else 
            echo "Account added.";
    } catch (PDOException $e) {
        echo 'Connection failed: ' . $e->getMessage();
    }    
}
AddNewAccount();
?>

Table Definition

enter image description here

Web-Page

ron tornambe
  • 10,452
  • 7
  • 33
  • 60

0 Answers0