Re: postgresql database access failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



    Readers?  Sounds like you spend too much time writing newsletters
(to the wrong address, since php-general-digest-help@xxxxxxxxxxxxx is
a self-help command list for digest-form subscriptions).  ;-P

On Sat, Apr 30, 2011 at 04:41, e-letter <inpost@xxxxxxxxx> 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/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux