Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8889619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:18:19+00:00 2026-06-14T22:18:19+00:00

Well I just started using this new php PDO, and am having this issue.

  • 0

Well I just started using this new php PDO, and am having this issue. I have a database with a table set up with 19 feilds or so. some are automatically handeled by the database its self, hence the ommitence in the insert section of the code.

The error comes up when the proccess tries to input the phone number into the database. The database is set to accept 12 varchar. The number has 12 varchar as well, but when I look at the debugging info, it looks like the whole function is ommiting the last digit of the phone number and giving me an error of:

array (
  0 => '42000',
  1 => 1064,
  2 => 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near \')

I am not sure as to what is going on here. If anyone can point me in the right direction that would be great. Here is my code for the script.

<?php
require_once('../wp-includes/class-phpass.php');

//Create var names
$first_name = $_POST['F_Name'];
$last_name = $_POST['L_Name'];
$phone_number_1 = $_POST['Pnumber1'];
$phone_number_2 = $_POST['Pnumber2'];
$address = $_POST['Address'];
$state = $_POST['State'];
$city = $_POST['City'];
$zip_code = $_POST['Zip'];
$email_1 = $_POST['Email1'];
$email_2 = $_POST['Email2'];
$username = $_POST['Uname'];
$password_1 = $_POST['Pass'];
$jed = $_POST['Jednostka'];
$dob = $_POST['DOB'];
$stopien = $_POST['Stopien'];
$funk = $_POST['FUNK'];
$fullName = $_POST['F_name'].' '.$_POST['L_name'];  
$hasher = new PasswordHash(8, True);
$password = $hasher->HashPassword($password_1);
$ENC =MD5($password_1);
$ERRmsg = "";

    //Checks if any feilds were left empty and creates an error message to display
        if(empty($first_name)) $ERRmsg .= 'You did not enter a First Name!  Pleaase go back and try again! <br/>';
        if(empty($last_name)) $ERRmsg .= 'You did not enter a Last Name!  Please go back and try again! <br/>';
        if(empty($phone_number_1)) $ERRmsg .= 'You did not enter a Phone Number!  Please go back and try again! <br/>';
        if(empty($address)) $ERRmsg .= 'You did not enter an Address!  Please go back and try again! <br/>';
        if(empty($state)) $ERRmsg .= 'You did not choose a State!  Please go back and try again! <br/>';
        if(empty($city)) $ERRmsg .= 'You did not enter a City!  Please go back and try again! <br/>';
        if(empty($zip_code)) $ERRmsg .= 'You did not enter a Zip Code.  Please go back and try again!<br/>';
        if(empty($email_1)) $ERRmsg .= 'You did not enter a Email.  Please go back and try again!<br/>';
        if(empty($email_2)) $ERRmsg .= 'You did not re-enter you Email.  Please go back and try again!<br/>';
        if(empty($username)) $ERRmsg .= 'You did not enter a Username.  Please go back and try again!<br/>';
        if(empty($password_1)) $ERRmsg .= 'You did not enter a password!  Please go back and try again!<br/>';
        if(empty($jed)) $ERRmsg .= 'You did not choose a Jednostka!  Please go back and try again!<br/>';
        if(empty($dob)) $ERRmsg .= 'You did not enter a Date of Birth!  Please go back and try again!<br/>';
        if(empty($stopien)) $ERRmsg .= 'You did not choose a Stopien!  Please go back and try again!<br/>';
        if(empty($funk)) $ERRmsg .= 'You did not enter a Funkcjia!  Please go back and try again!<br/>';
        if($email_1 !== $email_2) $ERRmsg .= 'Your emails did not match!  Please go back and try again!<br/>';

            //Checks to see if error message is empty, if empty does rest of code
            if(empty($ERRmsg))
            {
                try {
                $wdp = new PDO('mysql:host=localhost; dbname=***********', '***********', '***********');
                    echo "<p>Connected to Warta Database</p>\n";
                $wdp->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
                        //prepare the SQL statement
                            $wdp_insert = $wdp->prepare
                            ("INSERT INTO Users( 
                            F_NAME,
                            L_Name,
                            P_number1,
                            P_number2,
                            Address,
                            City,
                            State,
                            Zip,
                            Email,
                            username,
                            password,
                            Jednostka,
                            DOB,
                            Stopien,
                            Funkcjia,
                            High,
                            Active,
                            user_email,
                            user_login,
                            user_pass,
                            user_nicename,
                            display_name,
                        )
                        VALUES (
                            :fname,
                            :lname,
                            :pnumber1,
                            :pnumber2,
                            :address,
                            :city,
                            :state,
                            :zip,
                            :email,
                            :username,
                            :password,
                            :jednostka,
                            :DOB,
                            :Stopien,
                            :funkcjia,
                            :jednostka,
                            0,
                            :email,
                            :username,
                            :password,
                            :fullname,
                            :fullname,
                        )"
                        );

                                //Bind the paramaters
                                $wdp_insert->bindParam(':fname', $first_name);
                                $wdp_insert->bindParam(':lname', $last_name);
                                $wdp_insert->bindParam(':pnumber1', $phone_number_1);
                                $wdp_insert->bindParam(':pnumber2', $phone_number_2);
                                $wdp_insert->bindParam(':address', $address);
                                $wdp_insert->bindParam(':city', $city);
                                $wdp_insert->bindParam(':state', $state);
                                $wdp_insert->bindParam(':zip', $zip_code);
                                $wdp_insert->bindParam(':email', $email_1);
                                $wdp_insert->bindParam(':username', $username);
                                $wdp_insert->bindParam(':password', $password);
                                $wdp_insert->bindParam(':jednostka', $jed);
                                $wdp_insert->bindParam(':DOB', $dob);
                                $wdp_insert->bindParam(':Stopien', $stopien);
                                $wdp_insert->bindParam(':funkcjia', $funk);
                                $wdp_insert->bindParam(':fullname', $fullName);

                        //Execute the prepared statement
                            $wdp_insert->execute();
                            echo ("<p>Insert complete</p>\n");
                } catch (PDOException $ex) {
                $msg = $ex->errorInfo;
                error_log(var_export($msg, true));
                die("<p>Sorry, there was an unrecoverable database error. Debug data has been logged.</p>");
                };

            }
            else {
                echo ($first_name .' '. $ERRmsg);
                exit;
            }

?>

Any help would be great!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T22:18:20+00:00Added an answer on June 14, 2026 at 10:18 pm

    You shouldn’t have a comma after displayname and :fullname, and before the ending parenthesis.

     . . .
     user_nicename,
     display_name,     <-- superfluous comma
    )
    VALUES (
     . . .
     :fullname,
     :fullname,     <-- superfluous comma
    )"
    

    Some languages (e.g. PHP and Perl) permit commas after the last element in a list, but SQL does not.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm pretty new to APEX ( well, just started using it ~an hour ago),
I have just started a new project and having had previous happy times with
Posted this on the structuremap group as well. We just started using structuremap last
I have just started using LINQ to XML , and I am having trouble getting the
So I've just started working with linq as well as using lambda expressions. I've
I have just started using and am falling in love with MVC design pattern.
I have just started using EF Code First to implement a simple blog. I
I have just started creating my first website, which is backed by a database
I just started diving into the world of Rails by reading the well known
Well, I've just started to learn Exceptions at college, here is a code that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.