Re: warning on fetch

From: Date: Mon, 07 Apr 2003 23:22:11 +0000
Subject: Re: warning on fetch
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-142765@lists.php.net to get a copy of this message
On 8 Apr 2003, Travel Jadoo wrote: > I get a warning when I do a simple > > $row = 0; > while( $data = @pg_fetch_object( $result, $row ) ) { > $array[$item] = $data ; > } > > Warning: pg_fetch_object() [function.pg-fetch-object]: Unable to jump to > row 0 on PostgreSQL result index 21. > > I know this is a most basic transaction so why should this generate a > warning and not say a notice? It's a nuisance as I like to see 'real' > warnings but not this sort of thing. Hmm, it should produce the E_WARNING but the @ will suppress it so the error shouldn't show up at all, are you sure the above code is correct? Anyway, do you first use pg_num_rows() to make any rows exist at all? Also, you should either not use the optional row parameter OR increment it as you are using it but not incrementing. Regards, Philip

« previous php.general (#142765) next »