php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49789 I want to make a query like this "UPDATE class=? WHERE user IN (?)"
Submitted: 2009-10-06 14:52 UTC Modified: 2009-10-06 15:03 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: seniuk01 at yahoo dot com Assigned:
Status: Not a bug Package: PDO related
PHP Version: 5.3.0 OS: IRELEVANT
Private report: No CVE-ID: None
 [2009-10-06 14:52 UTC] seniuk01 at yahoo dot com
Description:
------------
I want to make a query like this "UPDATE class=? WHERE user IN (?)" $sth = $DBH->prepare($query);
try
{
  $sth->execute(array('class1',$an_array));
}
catch(PDOException $e)
{
  die("PDO error: ".$e->getMessage()." (".__FILE__." ".__LINE__.")");
}
So I expect this to work .... but it didn't. :(

Reproduce code:
---------------
---
From manual page: book.pdo
---



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-10-06 15:03 UTC] sjoerd@php.net
Thank you for your bug report.

The behavior you want is neither supported by prepared statements or by PDO. Also, this is properly documented:

pdostatement.execute.php:
You cannot bind multiple values to a single parameter; for example, you cannot bind two values to a single named parameter in an IN() clause.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 22:01:31 2024 UTC