How to interact with msql table fields?

0

I am creating a book exchange page, I made two tables of wishes and mine. until the part of the user's desire logged in to find the other books I managed to do, but I would like the other users to have the desire of the user's books logged. type: I have a book A and I want a B, and another user to have B and I want an A. My select q I have done so far

   SELECT b.meu,b.autor, b.genero,b.userid, b.foto
      FROM desejos AS a 
      INNER JOIN meus AS b ON
        (CONCAT('%', a.desejo,'%') LIKE CONCAT('%', b.meu,'%')or
        CONCAT('%', a.desejo,'%') LIKE CONCAT('%', b.genero,'%')or
        CONCAT('%', a.desejo,'%') LIKE CONCAT('%', b.autor,'%'))
      WHERE
        a.userid = $_SESSION[id]
          AND
        b.userid != $_SESSION[id]

I tried to put "and

   CONCAT('%', b.meu,'%') LIKE (CONCAT('%', a.desejo,'%') or  
   CONCAT('%', b.genero,'%') LIKE CONCAT('%', a.desejo,'%')or
   CONCAT('%', b.autor,'%') LIKE CONCAT('%', a.desejo,'%'))

But it did not work. the tables

    
asked by anonymous 24.04.2016 / 01:12

0 answers