I have document table with fields id
, sender_id
, receiver_id
and receiver_id
contains string value like U12,U13,U14 now I currently logged in user and I want to find all records in which receiver_id
contains my user_id
means my user_id
is U13
. now how to write the query to fetch records.
my query is:
$selDoc="SELECT * FROM documents WHERE sender_id='U".$_SESSION['userId']."' OR "U".$_SESSION['userId']." IN (receiver_id) ORDER BY id DESC";
but I got the error Unknown column 'U13' in 'where clause'
IN
isWHERE column_name IN (value1,value2,...)
– Aquarist