Page 1 of 1

[SOLVED] Implementation of PM

Posted: Sat Jan 04, 2014 1:15 am
by bagi
Hi everyone, i have db
dialogs
id; INT
title; TEXT
lastMessage; INT

dialogUsers
id; INT
dialogId; INT
user; INT
haveNewMsg; BOOL

messages
id; INT
time; INT
msgText; TEXT
dialogId; INT
user; INT
isNewMsg; BOOL
How I can get dialogId, which contains some users?

Re: Implementation of PM

Posted: Sat Jan 04, 2014 2:37 am
by requinix
You query for it.

Want to try explaining in more detail?

Re: Implementation of PM

Posted: Sat Jan 04, 2014 3:28 am
by bagi
Yes, but I wanted to ask specific query

Re: Implementation of PM

Posted: Sat Jan 04, 2014 4:15 am
by requinix
Then ask.

Re: Implementation of PM

Posted: Sat Jan 04, 2014 5:12 am
by bagi
I fixed that.
But here is new problem
mysql> insert into dialogs(title) OUTPUT INSERTED.ID values('1');
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'OUTPU
T INSERTED.ID values('1')' at line 1
mysql>
What's wrong?

Re: Implementation of PM

Posted: Sat Jan 04, 2014 6:53 am
by Celauran
There's a syntax error in your query. What is the query? What are you trying to do?

Re: Implementation of PM

Posted: Sat Jan 04, 2014 1:28 pm
by bagi
Celauran wrote:There's a syntax error in your query. What is the query? What are you trying to do?
insert into dialogs(title) OUTPUT INSERTED.ID values('1');
I have id columns (int primary key auto_increment). After inserting values I wanna get this id

Upd: found last_insert_id()