Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 5397347654A for ; Sun, 17 Nov 2002 23:41:30 -0500 (EST) Received: from riset4.risetdata.tld (unknown [202.155.40.209]) by postgresql.org (Postfix) with ESMTP id 9DC0947650F for ; Sun, 17 Nov 2002 23:41:21 -0500 (EST) Received: from riset4.risetdata.tld (riset4.risetdata.tld [192.168.0.235]) by riset4.risetdata.tld (Postfix) with ESMTP id CB43620043 for ; Mon, 18 Nov 2002 11:48:58 +0700 (WIT) Content-Type: text/plain; charset="iso-8859-1" From: Budi Rianto To: pgsql-php@postgresql.org Subject: Re: Inquiry From Form [pgsql] Date: Mon, 18 Nov 2002 11:48:41 +0700 X-Mailer: KMail [version 1.4] References: In-Reply-To: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200211181148.57873.brianto@freenet.de> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200211/73 X-Sequence-Number: 1655 -----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=20 becoming similar with the MySQL+PHP. For instance, you don't need to know t= he=20 numrows first to do a loop that display a query result. New PostgreSQL+PHP way: while($display=3Dpg_fetch_array($getquery)) { ... } MySQL way : while($display=3Dmysql_fetch_array($getquery)) { ... } You can also use pg_numrows() instead of pg_num_rows() and some other 'new'= =20 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=3D =3D3lBF -----END PGP SIGNATURE-----