From: Budi Rianto <brianto@freenet.de>
To: pgsql-php@postgresql.org
Subject: Re: Inquiry From Form [pgsql]
Date: Mon, 18 Nov 2002 11:48:41 +0700
Message-ID: <200211181148.57873.brianto@freenet.de> (raw)
In-Reply-To: <Pine.BSF.4.44.0211170524530.37645-100000@themode.com>
References: <Pine.BSF.4.44.0211170524530.37645-100000@themode.com>
-----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-----
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: brianto@freenet.de
Subject: Re: Inquiry From Form [pgsql]
In-Reply-To: <200211181148.57873.brianto@freenet.de>
References: <Pine.BSF.4.44.0211170524530.37645-100000@themode.com> <200211181148.57873.brianto@freenet.de>
* 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