SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2012
    Posts
    99
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    No primatiers bound

    Hey there, I am running into an error that is escaping me,


    Here's the code

    Warning: PDOStatement::execute() [pdostatement.execute]: SQLSTATE[HY093]: Invalid parameter number: no parameters were bound in /var/www/ageasy/processesAccount.php on line 40 line 40 is the first line in the code here.

    PHP Code:
    if($res $check->execute($vlaues['1']))
                    {
                        if(
    $res->fetchColumn() < 1)
                            {
                                
    $query['2'] = 'INSERT INTO users SET
                                        email = :email,
                                        password = :password,
                                        dateJoined = CURDATE(),
                                        farmName = :farmName,
                                        name = :name,
                                        salt1 = :salt1,
                                        salt2 = :salt2,
                                        limt_results = `15`,
                                        level = `2`,
                                        reciveEmail = :recive'
    ;
                                
    $values['2'] = array('email' => $clean->text($_POST['email']), 'password' => $clean->text($_POST['password']), 'farmname' => $clean->text($_POST['farmname']), 'name' => $clean->text($_POST['farm']), 'salt1' => $salt['2'], 'salt2' => $salt['1'], 'reciveEmail' => $_POST['reciveEmail'] );
                                
    $insert $pdo->prepare($query['2']);
                                
    $insert->execute($values['2']);


                                echo 
    "Hello {$_POST['name']}, \n  your account has been created! you can login with {$_POST['email']} and your correct password";
                                
    mail($_POST['email'],'no-reply@ageasy.ca','Your New Account!',$message,'support@ageasy.ca');                                
                            } 
    Thanks for the help! I have allready checked that $_POST['email'] contents a address and it does.

  2. #2
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,806
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    First line:
    PHP Code:
    if($res $check->execute($vlaues['1'])) 
    check the spelling in $values
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  3. #3
    SitePoint Enthusiast
    Join Date
    Apr 2012
    Posts
    99
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Thud!

    Thanks <feels kind of stupid>

    Now a different question, i have been using this example http://php.net/manual/en/pdostatement.rowcount.php (#2) and am getting this error : Call to a member function fetchColumn() on a non-object with this line ( if($res->fetchColumn() < 1) )

    thanks

  4. #4
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,806
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    where does $values[1] come from?
    Does it contain the prepared SQL statement?

    echo it and see what it says.
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  5. #5
    SitePoint Enthusiast
    Join Date
    Apr 2012
    Posts
    99
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    values['1'] contains the email address for row count, it is the values that are used in the execution of the query. Could not echo it (it's an array) had to use use var_dump and it returned array(1) { ["email"]=> string(21) "someemailhere" } , so what i was exepecting it to return

  6. #6
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Look closely at this placeholder, I think this might be causing the problem.
    PHP Code:
    reciveEmail = :recive'; 
    vs your binding:
    PHP Code:
    'reciveEmail' => $_POST['reciveEmail'] ) 
    SB
    PHP Code:
    reciveEmail = :reciveEmail'; 
    Formatting your code would make it more readable and therefore easier to spot inconsistencies like this.
    PHP Code:
    $values['2'] = array('email' => $clean->text($_POST['email'])
    'password' => $clean->text($_POST['password'])
    'farmname' => $clean->text($_POST['farmname'])
    // and so on 


Bookmarks

Posting Permissions

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