Re: What is wrong with this code?

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

 



On 4/28/10, Jochem Maas wrote:
> Op 4/28/10 7:39 AM, Gary . schreef:
>> class Pg_Error
>> {
    const INTEGRITY_CONST_UNIQUE = '23505';
>>     private static $errors =
>>         array(INTEGRITY_CONST_UNIQUE => 'uniqueness constraint violated');
>> ...
>>     public static function getMessage($ec)
>>     {
>>         $text = '';
>>         if (array_key_exists($ec, Pg_Error::$errors))
>>         {
>>             $text = Pg_Error::$errors[$ec];
>>         }
>>
>>         return $text;
>>     }
>> ...
>> }
...
> I'd be looking at making sure the constant 'INTEGRITY_CONST_UNIQUE' is
> actually
> defined before you load the class ...

I accidentally deleted it in the example I posted. Sorry. The actual
code includes the above const. But you put me on the right track, the
array entry wasn't using the const value as a key...

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux