Re: parameters not working under PDO

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Check $parts.. print_r($parts) and make sure its 1) an array 2)
contains 2 values

On 10/31/07, Chris Curvey <chris@xxxxxxxxxxxxxxx> wrote:
> It's quite possible that I'm missing something obvious here.  The
> following code fragment does not return any rows, but if I take out the
> parameters and replace them with hardcoded strings (enclosed in single
> quotes), I get the right results.
>
> I've scattered "print" statements throughout, and the query seems to get
> past execute() OK, it's just not returning anything from the call to fetch()
>
> Am I missing something obvious?
>
> $stmt = $conn->prepare("select t.z from towns t
>                          join counties c on t.county_z = c.z
>                          where t.me = ?
>                          and c.state_z = ?");
> if ($stmt->execute($parts)) {
>      while ($row = $stmt->fetch()) {
>           $town_z = $row['z'];
>      }
> } else {
>      print $stmt->errorCode();
>      print_r($stmt->errorInfo());
> }
>
> Thanks in advance!
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux