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

From scott.marlowe
Subject Re: Inquiry From Form [pgsql]
Date
Msg-id Pine.LNX.4.33.0211181004390.17026-100000@css120.ihs.com
Whole thread Raw
In response to Inquiry From Form [pgsql]  (William <DarkCancerian@netscape.net>)
Responses Re: Inquiry From Form [pgsql]
List pgsql-php
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?

Not really.  The only issue is if you used MySQL proprietary stuff.
There's a lot of things in MySQL that are workarounds for it not being a
transactional database that won't work in Postgresql, but using the
"right" method (i.e. a transaction or ANSI SQL) will work just fine.

The only other thing to change is your mysql_xxx commands to pgsql_xxx
commands.

Also, Postgresql doesn't have a pgsql_lastinsert_id like MySQL, instead,
you do it like this:

(Warning pseudocode... :-)

begin;
insert into table yada (field1, field2) values (val1, val2);
select currval('yada_seq');
insert into table yada_child (field1, field2, y_id) values (val1, val2,
y_id);
commit;

i.e. you use currval('seqname') to find out what the id was that was just
inserted.


pgsql-php by date:

Previous
From: Adam Witney
Date:
Subject: Re: Transaction including two web page + timer
Next
From: "scott.marlowe"
Date:
Subject: Re: Inquiry From Form [pgsql]