pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Young <hbrucey@yahoo.com>
To: pgsql-php@postgresql.org
Subject: Re: can't retrieve data through PHP
Date: Sat, 26 Oct 2002 10:41:29 -0700 (PDT)
Message-ID: <20021026174129.26246.qmail@web10406.mail.yahoo.com> (raw)
In-Reply-To: <20021026172806.GF12484@lunar.radom.org>

php connection query:

<?php
        #include('DB/pgsql.php');

	$dbconnect = pg_connect("dbname=campus user=apache");
	
	
	$result = pg_exec ($conn, "select * from friends");	
	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]&nbsp;";
	   }
	   echo "<br>";
       }
	pg_close($dbconnect);
?>


--- dan radom <dan@radom.org> wrote:
> * Bruce Young (hbrucey@yahoo.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@postgresql.org)


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



view thread (6+ messages)  latest in thread

Message-ID: <20021026174129.26246.qmail@web10406.mail.yahoo.com>
Permalink:  ../20021026174129.26246.qmail@web10406.mail.yahoo.com/
Also on:    postgresql.org/message-id/20021026174129.26246.qmail@web10406.mail.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: hbrucey@yahoo.com
  Subject: Re: can't retrieve data through PHP
  In-Reply-To: <20021026174129.26246.qmail@web10406.mail.yahoo.com>
  References: <20021026172806.GF12484@lunar.radom.org> <20021026174129.26246.qmail@web10406.mail.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox