number of bound variables does not match number of tokens..

Discussion in 'PHP' started by afridy, Mar 25, 2015.

  1. #1
    Hi folks,
    please help me to find this annoying bug.

        $query = $db->prepare("INSERT
                               INTO customers(name,city,address,phone,date)
                               VALUES(:name,:city,:address,:phone,date)");
     
        $query->execute(array(':name' => $name,
                              ':city' => $city,
                              ':address' => $address,
                              ':phone' => $phone,
                              ':date' => $date));
        $affected_rows = $query->rowCount();
    
    PHP:
    Table layout
    customer_id[auto inc) - name - city - address - phone - date
     
    Last edited: Mar 25, 2015
    afridy, Mar 25, 2015 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    You're missing a : in front of date in the values in the query
     
    PoPSiCLe, Mar 25, 2015 IP