Hey, I'm having trouble dealing with this - I made a table:
create table prodzina(
ID_prac integer references Ppracownicy,
stan_cywilny varchar(20),
ilosc_dzieci integer,
ubezpieczenie bool);
and I got my script <part of it>:
x_find='SELECT * from ppracownicy where nazwisko='+a+nazw+a+' and imie='+a+imie+a+' and id_dzial='+a+iddzial+a+' and pensja='+a+pensja+a+' and stanowisko='+a+stan+a+''
cur.execute(x_find)
rows=cur.fetchall()
idpracownika=""
for row in rows:
idpracownika=row[0]
if choice=="2":
//and now I'm trying to insert that table with, like so:
x_default='insert into prodzina values ('+idpracownika+','+a+'kawaler'+a+',0,false)'
cur.execute(x_default)
The type of the field I'm refering to in ppracownicy is serial primary key.
Oh, and all those a == ', for example where nazwisko='+'+nazw+'+'
Inserting this way did work for a table with no references to another one, but here I get an error:
Can't concatenate an int object with a str object.
How can I insert values with one of them referring to another table, and the rest of the values inserted as constants?