Re: postgresql database access failure

From: Date: Sat, 30 Apr 2011 16:23:43 +0000
Subject: Re: postgresql database access failure
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-312593@lists.php.net to get a copy of this message
Readers? Sounds like you spend too much time writing newsletters (to the wrong address, since php-general-digest-help@lists.php.net is a self-help command list for digest-form subscriptions). ;-P On Sat, Apr 30, 2011 at 04:41, e-letter <inpost@gmail.com> wrote: >        <?php >                $db = pg_connect('dbname=databasename user=username'); >                $query = 'SELECT * FROM databasename'; >                $value=pg_fetch_result($query,1,0); >                echo 'export of database is ',$value,''; >        ?> >        <p> >                why does this fail? How is it failing? What error(s) are you seeing on screen or in your log files? Noting that $value would contain an array, is that the problem? And why are you using ending quotes in your echo? You should just place the semicolon immediately after $value. >        </p> >        </body> > </html> > > The following php code produces the user agent: > >        <?php >                echo '$_SERVER['HTTP_USER_AGENT']'; >        ?> First of all, no it doesn't. Placed inside single quotes, it'll not only try to return it verbatim (i.e. - the variable would be printed to screen), but it'll also cause a parse error, as you reuse single quotes in the variable key container. -- </Daniel P. Brown> Network Infrastructure Manager http://www.php.net/

« previous php.general (#312593) next »