Re: Inquiry From Form [pgsql] - Mailing list pgsql-php

From Budi Rianto
Subject Re: Inquiry From Form [pgsql]
Date
Msg-id 200211181148.57873.brianto@freenet.de
Whole thread Raw
In response to Inquiry From Form [pgsql]  (brew@theMode.com)
List pgsql-php
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sunday 17 November 2002 05:43 pm, you wrote:
> On Fri, 15 Nov 2002, William wrote:
> > I code with PHP and use it to communicate with MySQL, if I started using
> > PostgreSQL would I have to change my coding to communicate with the
> > database?
>
> Probably, but only slightly.
>
> I changed my DB from MySQL to PostgreSQL and had to change each SQL call
> slightly.  It seems to me the difference was PostgreSQL needs to know the
> number of rows gotten and then loop through them with a for loop, with
> MySQL I was able to use a while loop without checking the number of rows
> first.
>
[snip]

Using PostgreSQL 7.2 and PHP 4.1.2 in Linux, I found that some code is
becoming similar with the MySQL+PHP. For instance, you don't need to know the
numrows first to do a loop that display a query result.

New PostgreSQL+PHP way:

while($display=pg_fetch_array($getquery))
    {
        ...
    }

MySQL way :
while($display=mysql_fetch_array($getquery))
    {
        ...
    }

You can also use pg_numrows() instead of pg_num_rows() and some other 'new'
syntax that are like mysql way.

HTH
Budi.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE92HE1ZVSaxFm5xCIRAr1pAKCTnSD+hUoXe3+L+XXDONwhne49uACgtkGZ
CsVGw+0Y9nji8MZj8D50e7s=
=3lBF
-----END PGP SIGNATURE-----


pgsql-php by date:

Previous
From: brew@theMode.com
Date:
Subject: Inquiry From Form [pgsql]
Next
From: "Andy Dunlop"
Date:
Subject: Nested select to same tsble