Results 1 to 2 of 2

Thread: PHP insert prepare error

  1. #1
    Join Date
    Dec 2008
    Posts
    58

    PHP insert prepare error

    PHP Code:
    $stmt $conn->prepare("INSERT INTO tbljobseeker(EMail_Address,User_Password,FirstName,LastName,Gender,Date_of_birth,Register_Date,User_Block,Lastvisit_Date,Activate_Code) VALUES(?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");

                    
    $stmt->bind_param($EMail_Address$sha1pass$FirstName$LastName$Gender$birth_date,$birth_date,$zero,$birth_date,$activate);

                    
    $stmt->execute(); 
    and i get error :Fatal error: Call to a member function bind_param() on a non-object in

    i have 11 parameter(?) but i send only 10 value because (i think)have 1 auto number field.
    and if have 10 parameter(?) i get this error :Number of elements in type definition string doesn't match number of bind variables in

  2. #2
    Join Date
    Oct 2010
    Location
    Montreal, Quebec, Canada
    Posts
    44
    I have two things to answer to you.
    First off, the error that you posted usually occurs when the $stmt object was not initallized properly. Possibly because the connection was not properly made or the prepare statement did not function correctly.

    Secondly, you have 11 question marks in your INSERT statement and only 10 variables. If the first one is actually an autonumber field then you should not put a ? into that field, you should put empty simple quotes such as ''.

    That will most likely fix your problem
    More than just a simple web hosting service. Our goal is to provide your business with a Web Presence.
    Affordable Hosting Solutions, Domain Name Registration, E-Mail Marketing Solutions, Social Media Networking, and more.
    Let us show you how you can be your own webmaster

Similar Threads

  1. Error after uploading a php file in networksolutions
    By orangedezign in forum Web Hosting and Domain Names
    Replies: 0
    Last Post: 04 Oct 2010, 03:13 AM
  2. PHP - application fatal error: "undefined function detectlanguage()"
    By alexmel7 in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 1
    Last Post: 01 Sep 2009, 01:23 AM
  3. open_basedir restriction in effect error in PHP
    By BenR41 in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 1
    Last Post: 27 Feb 2008, 05:41 PM
  4. PHP MySQL connection error
    By dge_475 in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 1
    Last Post: 17 Apr 2006, 03:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •