mysql_query("SELECT * FROM `notifications` INNER JOIN `users` ON users.vk_id = notifications.from WHERE notifications.to = '$user_vk_id' OR notifications.from = '$user_vk_id'"); 

I still need to create ON users.vk_id = notifications.to. Like that:

 ON users.vk_id = notifications.from ON users.vk_id = notifications.to 

But how to write, I do not catch up.

    1 answer 1

    AND instead of the second ON

    • @minamoto, and now how to understand where from, and where to? It outputs one thing. Example clip2net.com/clip/m40641/1353443408-clip-1kb.png - ModaL
    • @minamoto, more precisely, for some reason, it displays half of the materials now. - ModaL
    • one
      I do not really understand then what is necessary. Formulate the question so that it is clear what you want to get, not what to do. Because "I need to create ON users.vk_id = notifications.to" is the wrong question, you do not need it. You can still try this, maybe it should be: SELECT * FROM notifications INNER JOIN users u1 ON u1.vk_id = notifications.from = '$ user_vk_id' - minamoto
    • @minamoto, you are definitely driving! - ModaL
    • @minamoto Just not AND, but OR (in the source text, change one letter) Otherwise, you will receive a notification from yourself to yourself. "Quietly with myself I am talking" - alexlz