mysql - PHP Message History (Two tables, two same colums.) -


i'm posting here today because i'm in conundrum. i'm trying make messaging history custom website i'm having trouble identifying mistakes making.

i have 2 different tables, 1 named messages , other named messages_sent , both share same columns mess_by, mess_to, , mess_id.

when member trying view history display as:

member 1: hey - id 2

memeber 2: how you? - id 1

the code attempting use replicate said function is:

select * messages mess_by = x , mess_to = y union select * messages_sent mess_by = y , mess_to = x order mess_id desc

x = who's from.

y = receiver.

unfortunately above code not seem work accurately, next plan use:

select * messages mess_to= y , mess_by= x or mess_by= y , mess_to= x order mess_id desc

x = who's from.

y = receiver.

which "sorta" worked, doesn't bring history messages_sent.

if me this, appreciated, thank & have great year!


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

python - pip wont install .WHL files -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -