NYCPHP Meetup

NYPHP.org

[nycphp-talk] $sth->fetch(PDO::FETCH_ASSOC); = Undefined class constant 'FETCH_ASSOC'

Greg Rundlett greg.rundlett at gmail.com
Tue Oct 18 10:48:21 EDT 2005


On 10/18/05, Alan T. Miller <amiller at criticalmedia.biz> wrote:
> I have been playing around with the new PDO objects in PHP 5.1 and for
> some reason I cannot get any of the constants to work.  I have followed
> the examples to the wire but no matter what I try, I keep getting an
> error telling me that the constants are undefined. Anyone else have this
> problem so far? Any sugestions?
>
> Statements such as: $sth->fetch(PDO::FETCH_ASSOC);  will always yield a
> simular error:
>
> *Fatal error*: Undefined class constant 'FETCH_ASSOC'

Find out what class defines the constant (by searching for the
'FETCH_ASSOC' string, or otherwise).  Find out if that class file is
included, or if that class is defined using 'class_exists()'
http://us2.php.net/class_exists.  Given the error, it is likely that
your code is not including the required class file.  It could also be
possible that the class defines the constant incorrectly, but that is
less likely.


>
> My test code follows what you will find at:
>
> http://php.planetmirror.com/manual/en/function.pdostatement-fetch.php
>
> Alan
> _______________________________________________
> New York PHP Talk Mailing List
> AMP Technology
> Supporting Apache, MySQL and PHP
> http://lists.nyphp.org/mailman/listinfo/talk
> http://www.nyphp.org
>



More information about the talk mailing list