ricardoaux Posted December 4, 2012 at 06:23 PM Report #485725 Posted December 4, 2012 at 06:23 PM (edited) Boas Tenho as seguintes tabelas: create table "muchatcha"."MESSAGE" ( ID_MESSAGE serial UNIQUE not null, ID_USER serial not null, FIL_ID_MESSAGE integer null, CONTENT varchar(500) null, constraint PK_MESSAGE primary key (ID_MESSAGE) ); create table "muchatcha".CHAT_MESSAGE ( ID_MESSAGE serial UNIQUE not null, ID_ROOM serial not null, ID_USER serial not null, CONTENT varchar(500) null, constraint PK_CHAT_MESSAGE primary key (ID_MESSAGE) ); create table "muchatcha".PRIVATE_MESSAGE ( ID_MESSAGE serial UNIQUE not null, ID_USER serial not null, USE_ID_USER serial not null, CONTENT varchar(500) null, SENT_DATE timestamp null, RECEIVED_DATE timestamp null, constraint PK_PRIVATE_MESSAGE primary key (ID_MESSAGE) ); Como adiciono algo na tabela private_message??? Uso o Postgres Cumps Edited December 4, 2012 at 07:54 PM by Rechousa Formatação de código
NunoDinis Posted December 4, 2012 at 07:55 PM Report #485752 Posted December 4, 2012 at 07:55 PM Da mesma forma que inseres nas outras.. Estranha forma de vida que tem a capacidade de transformar comandos em mensagens de erro. ndsotware.org
ricardoaux Posted December 4, 2012 at 09:07 PM Author Report #485768 Posted December 4, 2012 at 09:07 PM dá me um erro... Query failed: ERRO: relação "muchatcha.private_messsage" não existe
NunoDinis Posted December 4, 2012 at 09:17 PM Report #485771 Posted December 4, 2012 at 09:17 PM Coloca o código aqui. Estranha forma de vida que tem a capacidade de transformar comandos em mensagens de erro. ndsotware.org
ricardoaux Posted December 4, 2012 at 09:28 PM Author Report #485776 Posted December 4, 2012 at 09:28 PM (edited) pg_query("BEGIN") or die("Transaction commit failed\n"); pg_query($dbh, "INSERT INTO \"muchatcha\".\"MESSAGE\" (id_user, content)"."VALUES('$userM_Id', '$mensM')"); $result = pg_query($dbh, "SELECT MAX(id_message) FROM \"muchatcha\".\"MESSAGE\""); $row = pg_fetch_row($result); $idM = $row[0]; echo $idM; pg_query($dbh, "INSERT INTO \"muchatcha\".\"private_messsage\" (id_message, id_user, use_id_user, content, sent_date, received_date)"."VALUES('$idM', '$userM_Id', '$userID', '$mensM', '$dateS', '$dateR')"); pg_query("COMMIT") or die("Transaction commit failed\n"); Edited December 4, 2012 at 10:37 PM by Rechousa Formatação de código
NunoDinis Posted December 4, 2012 at 10:56 PM Report #485798 Posted December 4, 2012 at 10:56 PM Faz um teste no Postgres da query para ver se executa. O problema não será do código. Ele queixa-se das relações.. Estranha forma de vida que tem a capacidade de transformar comandos em mensagens de erro. ndsotware.org
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now