Iinvalid parameter #?

this error seems confusing, but I printed the SQL Query and the parameters. Arent they both 4?

SQL: INSERT INTO experiences (userID,title,experience,ip) VALUES (:id,':title',':experience',':ip')
Parameters

Array
(
    [:id] => 1
    [:title] => ASDxdv
    [:experience] => cvncv
    [:ip] => 107.218.57.40
)

Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens in /hermes/walnaweb03a/b2451/moo.lukesspotcom/frommyexperience/php/add_experience_logic.php on line 31 SQL Query error

is it ok if I get rid of the 's in the query?

1 Like

Dont put quotes around the other binds. That’s what prepared statements are for; part of it’s preparation for execution is to wrap parameters as required.

2 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.