Re: pgsql and exception [message #178115 is a reply to message #178113] |
Mon, 14 May 2012 12:54 |
M. Strobel
Messages: 386 Registered: December 2011
Karma:
|
Senior Member |
|
|
Am 14.05.2012 14:24, schrieb Une Bévue:
> On 14/05/12 09:45, "Álvaro G. Vicario" wrote:
>> This isn't a database error, it's a PHP error. The line where you define
>> $ret's current value:
>>
>> $ret=$db->query($sql);
>>
>> ... failed. Such function should return a object but it didn't
>> (probably, because it returned FALSE instead).
>>
>> «Return Values: A query result resource on success or FALSE on failure.»
>
> right, however the PHP error is due to an SQL one :
> i was attempting to put a string of length > 30 in a column of type "varchar(30)".
>
> right now I'm testing $ret :
>
> if($ret){
> // do normal way
> } else {
> // print error
> }
>
> putting try / catch around that does nothing...
so you don't know what I was talking about.
See ERRMODE at http://php.net/manual/en/pdo.setattribute.php
/Str.
|
|
|