I use redbean php. the user likes, it is written into the 'post' table as there is a common table 'user2like' where the post id is written and the user id is the structure user2like
id
user_id
post_id
I can not understand how to check that the user has put a certain post Like I tried to check but it turns out that he puts all posts as certain
cycle
foreach ( $pjk as $posting ) { $like=R::findOne('user2like', 'post_id = ? AND user_id=?', array($posting['id'], $_SESSION['logged_user']->id)); if (/*не могу понять как проверить*/) { $l= 'вы уже поставили' ; } echo '<div class="col-auto" id="text_posting_user" data-id="'.$posting['id'].'" style="padding: 1.7em; padding-bottom: 0;"> <div class="text_p"><p>'.$posting['post'].'</p></div> <hr style="margin-bottom: 0.5rem;"> <div class="b_funk_post"> <table> <tr> <td><div class="like" data-id="'.$posting['id'].'">'.$posting['like'].'</div>'.$l.'</td> </tr> </table> </div> </div>'; }
post_id=? and user_id=?entrypost_id=? and user_id=?post_id=? and user_id=?... - Mike