1
I’m creating a book exchange page, I made two tables of wishes and mine. until the part of the logged-in user wish to find other’s books I was able to do, but I would also like the other users to have as wish the logged-in user’s books. type: I have a book A and wish a B and another user have the B and wish an A, and appear only results with these conditions. the field of desire can be title, author and gender. My select q made 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]
tentei colocar "and
CONCAT('%', b.meu,'%') LIKE (CONCAT('%', a.desejo,'%') or
CONCAT('%', b.genero,'%') LIKE CONCAT('%', a.desejo,'%')or
CONCAT('%', b.autor,'%') LIKE CONCAT('%', a.desejo,'%'))