0

I've been converting my php statements over to PDO but I'm having a rough time. I have the following insert command but it fails to insert and doesn't throw any errors. Any idea why it wouldn't be inserting?

try{
            $dbConnect = new PDO($dbConnect, $username, $password);
        } catch (PDOException $error) {
            echo 'Error Connecting: ' . $error->getMessage();
        }

        $reg = $dbConnect->prepare('INSERT INTO `user` (
            `userID`, 
            `firstName`, 
            `lastName`, 
            `title`, 
            `suffix`, 
            `suffixTwo`, 
            `email`, 
            `employer`, 
            `expertise`, 
            `primaryAddress`, 
            `secondaryAddress`, 
            `primaryPhone`, 
            `secondaryPhone`, 
            `city`, 
            `postalCode`, 
            `hash`
            )

            VALUES (
            NULL,
            :firstName, 
            :lastName, 
            :title, 
            :suffixOne, 
            :suffixTwo, 
            :email, 
            :employer, 
            :expertise, 
            :primaryAddress, 
            :secondaryAddress, 
            :primaryPhone, 
            :secondaryPhone, 
            :city, 
            :zip, 
            :hash
            )');

        $reg->bindValue(":firstName", $firstName);
        $reg->bindValue(":lastName", $lastName);
        $reg->bindValue(":title", $title);
        $reg->bindValue(":suffixOne", $suffixOne);
        $reg->bindValue(":suffixTwo", $suffixTwo);
        $reg->bindValue(":email", $email);
        $reg->bindValue(":employer", $employer);
        $reg->bindValue(":expertise", $expertise);
        $reg->bindValue(":hash", $hash);
        $reg->bindValue(":primaryAddress", $primaryAddress);
        $reg->bindValue(":secondaryAddress", $secondaryAddress);
        $reg->bindValue(":firstName", $firstName);
        $reg->bindValue(":city", $city);
        $reg->bindValue(":state", $state);
        $reg->bindValue(":zip", $zip);
        $reg->bindValue(":country", $country);
        $reg->bindValue(":primaryPhone", $primaryPhone);
        $reg->bindValue(":secondaryPhone", $secondaryPhone);
        $reg->execute();
Tyharo
  • 383
  • 2
  • 5
  • 23

0 Answers0