Re: [INTERFACES] web interface php3 question. - Mailing list pgsql-php

From Adam Lang
Subject Re: [INTERFACES] web interface php3 question.
Date
Msg-id 016e01c042a9$ab899280$330a0a0a@6014cwpza006
Whole thread Raw
List pgsql-php
Wierd, but I almost think it is a problem with putting a literal number
instead of a variable.  that is the only difference I noticed.

Adam Lang
Systems Engineer
Rutgers Casualty Insurance Company
----- Original Message -----
From: "Rich.Martin" <Rich.Martin@wcom.com>
To: "Adam Lang" <aalang@rutgersinsurance.com>
Sent: Monday, October 30, 2000 2:41 PM
Subject: RE: [INTERFACES] web interface php3 question.


> Adam,
> I got it working using a code snippet from Chris Ryan. Here's what he
sent,
> below.
> Thanks again for your help and advice.
> Rich
> -=-=-=-=-=-
>
>
> pg_fetch_array() takes two parameters, the result and the row you want
> to fetch (0 based reference). Here is an example how I normally do stuff
> like this:
>
> -- code snippet --
> $query = "select x, y, z from table where x = 'something';
> $result = pg_exec($conn,$query);
>
> $r = 0;
> while($row = @pg_fetch_array($result,$r++)) {
>     /* process the row here */
> }
> pg_freeresult($result);
> -- end code snippet --
>
> Note the use of the @ symbol on pg_fetch_array(). This suppresses the
> error when you try referencing a row that doesn't exist and breaks the
> while loop. Another way of doing the look so you don't get an error at
> all is:
>
> -- code snippet --
> $rows = pg_numrows($result);
> for($r = 0; $r < $rows; $r++) {
>     $row = pg_fetch_array($result,$r);
> }
> -- end code snippet --
>
> Hope this all helps.
> Chris Ryan
> -=-=-=-=-=-=-=-
>
>
>
>
> -----Original Message-----
> From: Adam Lang [mailto:aalang@rutgersinsurance.com]
> Sent: Monday, October 30, 2000 12:33 PM
> To: Rich.Martin; pgsql-php@postgresl.org
> Subject: Re: [INTERFACES] web interface php3 question.
>
>
> There is no limit on database size for postgres.
>
> Actually, I'm getting an error on no row result also.... I'm going to look
> at other apps I have and see if there is anything different,
>
> Adam Lang
> Systems Engineer
> Rutgers Casualty Insurance Company
> ----- Original Message -----
> From: "Rich.Martin" <Rich.Martin@wcom.com>
> To: "Adam Lang" <aalang@rutgersinsurance.com>
> Sent: Monday, October 30, 2000 2:04 PM
> Subject: RE: [INTERFACES] web interface php3 question.
>
>
> > Yes, that what's got me confused. I've tried it with several variables,
> but
> > 0, 1, and 7 all get errors (described below). If I don't include any
> > variable I get the error message.
> >
> > I also have a book, PHP Essentials, which uses an example call to a
> > PostgreSQL database and they don't use two variable, but I get an error
> with
> > the same exact call.
> >
> > Could it be the size of database I'm calling? It has 7 columns but about
a
> > hundred rows. Do you know if there is a maximum size for a db?
> > Rich
> >
> >
> >
> >
> > -----Original Message-----
> > From: Adam Lang [mailto:aalang@rutgersinsurance.com]
> > Sent: Monday, October 30, 2000 11:42 AM
> > To: Rich.Martin; pgsql-interfaces@hub.org
> > Subject: Re: [INTERFACES] web interface php3 question.
> >
> >
> > It should work with version 3.  Are there 7 rows of data in the table?
It
> > might not let you call it if the row doesn't exist.
> >
> > http://php.net/manual/function.pg-fetch-array.php
> >
> > Adam Lang
> > Systems Engineer
> > Rutgers Casualty Insurance Company
> > ----- Original Message -----
> > From: "Rich.Martin" <Rich.Martin@wcom.com>
> > To: <pgsql-interfaces@hub.org>
> > Sent: Monday, October 30, 2000 1:19 PM
> > Subject: [INTERFACES] web interface php3 question.
> >
> >
> > > Hello,
> > > I'm trying to setup a web page that calls a PostgreSQL database. I'm
> > > connecting to the database ok. Does anyone know if php3 support
> > > pg_fetch_array? I keep getting an error that says:
> > >
> > > Warning: Wrong parameter count for pg_fetch_array() in
> > > /home/contacts/whole.phtml on line 72
> > >
> > > I'm calling it in the code like this:
> > >
> > > while ($r = pg_fetch_array($result)) {$company = $r["company'];
> > >
> > > if I add a another variable like this:
> > >
> > > while ($r = pg_fetch_array($result, 7)) {$company = $r["company'];
> > >
> > > the resulting page takes forever to load and repeats the first entry
to
> > the
> > > database. I know that the server I'm using has php3 on it. Is that the
> > > problem?
> > >
> > > If you have a solution please let me know.
> > > Thanks,
> > > Rich


pgsql-php by date:

Previous
From: Rodrigo Fernandez
Date:
Subject: Dirigir a: Re: php4 / pgsql7 problem (too many clients)
Next
From: "Adam Lang"
Date:
Subject: Re: [INTERFACES] web interface php3 question.