Using php & postgresql, I have 2 tables and a sequence as follows:
create sequence serial;
CREATE TABLE glmaster (
id int default nextval('serial'),
accno char(6) constraint accno_con not null unique,
isheader boolean default 'f',
isdebit boolean not null,
inactive boolean default 'f',
primary key (id)
CREATE TABLE glcheque (
id int references glmaster,
My problem is this, when inserting to glmaster, at times I want to also
insert the same value of id into glcheque. The values originate in a
form generated using php.
My first attempt was to insert all values except id into glmaster then
followed by (in php):
$sql = select id as glid from glmaster where accno = $glaccno;
$sql1 = insert into glcheque values ($glid);
that fails because $glid is not initialised.
My next attempt was '$sql = select nextval ('serial') as glid;' etc
Neither does this initialise $glid.
I'm not sure if this is simply a timing problem, or if there is something
wrong with my logic.
Thanks for any help given
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php