Question on PDO statements

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
phenam
Forum Newbie
Posts: 3
Joined: Thu Oct 14, 2010 4:15 pm

Question on PDO statements

Post by phenam »

Hey all, new to the forum. I am trying to switch over to using PDO prepared statements. However, in situations with using "WHERE IN()" clauses, or multiple insert values such as "INSERT INTO table VALUES (x), (y), (z), how would one bind values? Is the only solution just to issue multiple statements and individually bind each set of values? Thanks in advance for any input! Have a great day.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Question on PDO statements

Post by John Cartwright »

http://ca2.php.net/manual/en/pdo.prepare.php wrote: You must include a unique parameter marker for each value you wish to pass in to the statement when you call PDOStatement::execute(). You cannot use a named parameter marker of the same name twice in a prepared statement. You cannot bind multiple values to a single named parameter in, for example, the IN() clause of an SQL statement.
So yea, bind each value individually.
Post Reply