Re: can't retrieve data through PHP

From: Bruce Young <hbrucey(at)yahoo(dot)com>
To: pgsql-php(at)postgresql(dot)org
Subject: Re: can't retrieve data through PHP
Date: 2002-10-26 18:39:40
Message-ID: 20021026183940.32531.qmail@web10404.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

thanks guys for the quick response and tips.
everything works well now. dont know how i didnt catch that one.. :)

- bruce

--- Chadwick Rolfs <cmr(at)shell(dot)gis(dot)net> wrote:
> Your variables don't match. And your coding is very inconsistent.
> The if
> construct should follow the for construct. It makes everything
> READABLE
> and understandable.
> Good luck
>
> On Sat, 26 Oct 2002, Bruce Young wrote:
>
> > php connection query:
> >
> > <?php
> > #include('DB/pgsql.php');
> >
> > $dbconnect = pg_connect("dbname=campus user=apache");
>
> HERE YOU HAVE DBCONNECT
>
> >
> >
> > $result = pg_exec ($conn, "select * from friends");
>
> HERE YOU HAVE CONN
>
> > if (!result) {printf ("Error\n"); exit;}
> >
> > $numrows = pg_num_rows($result);
> >
> > for ($i=0; $i < $numrows; $i++) {
> > $r = pg_fetch_row($result, $i);
> >
> > for ($j=0; $j < count($r); $j++) {
> > echo "$r[$j] ";
> > }
> > echo "<br>";
> > }
> > pg_close($dbconnect);
> > ?>
> >
> >
> > --- dan radom <dan(at)radom(dot)org> wrote:
> > > * Bruce Young (hbrucey(at)yahoo(dot)com) wrote:
> > > > my script that does insert works correctly, but i get this
> error
> > > when
> > > > retrieving data:
> > > >
> > > > Warning: pg_exec(): supplied argument is not a valid
> PostgreSQL
> > > link
> > > > resource in /home/httpd/htdocs/view.php on line 115
> > > >
> > > > Warning: pg_num_rows(): supplied argument is not a valid
> > > PostgreSQL
> > > > result resource in /home/httpd/htdocs/view.php on line 118
> > > >
> > >
> > > how about showing us the connection and query parts of view.php
> > >
> > > dan
> > >
> > > ---------------------------(end of
> > > broadcast)---------------------------
> > > TIP 2: you can get off all lists at once with the unregister
> > > command
> > > (send "unregister YourEmailAddressHere" to
> > majordomo(at)postgresql(dot)org)
> >
> >
> > __________________________________________________
> > Do you Yahoo!?
> > Y! Web Hosting - Let the expert host your web site
> > http://webhosting.yahoo.com/
> >
> > ---------------------------(end of
> broadcast)---------------------------
> > TIP 2: you can get off all lists at once with the unregister
> command
> > (send "unregister YourEmailAddressHere" to
> majordomo(at)postgresql(dot)org)
> >
>
> -Chadwick
>

__________________________________________________
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site
http://webhosting.yahoo.com/

In response to

Responses

Browse pgsql-php by date

  From Date Subject
Next Message Chadwick Rolfs 2002-10-26 18:49:53 Re: can't retrieve data through PHP
Previous Message Chadwick Rolfs 2002-10-26 17:52:55 Re: can't retrieve data through PHP