Creating a FRIEND RELATION in MySQL and PHP -
i creating system keep relationships in application. when says stored in database id, , friend (in order). , when other person accepts request id of friend , other id (in reverse order) saved.
to verify 2 friends have see there these 2 rows.
the last problem when true, have retrieve name of friend table .. , not know how express in php.
i've been testing, , should this. here code:
select nombre users join friends (id=usuari_o or id=usuari_t) , (usuari_t='$id' or usuari_o='$id')
friends tables structure:
users table structure:
something this:
select original.nombre original_nombre, friends.usuari_o, target.nombre target_nobmre, friends.usuari_t friends left join users original on original.id = friends.usuari_od left join users target on target.id = friends.usuari_t;
Comments
Post a Comment