In general, there are three bases -
members - [id, cid, uid]
--------------------- dialogs - [id, type, name]
--------------------- users - [id, nickname].
My task is to get data. First we get the dialog itself (SQL below):
SELECT dialogs.id, dialogs.type, dialogs.name, FROM dialogs, members WHERE members.uid = "'.$my_id.'" AND dialogs.id = members.cid But, further, I need that if dialogs.type = 0 (private message), I have got another member - members.cid = id_of_free_dial_dialog, members.uid! = "'. $ My_id.'".