Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save exileed/36dc4a8381d545cbaecc96f5de4568e6 to your computer and use it in GitHub Desktop.
Save exileed/36dc4a8381d545cbaecc96f5de4568e6 to your computer and use it in GitHub Desktop.
<?php
$user_id = $_SESSION['user']['id'];
$STH = $pdo->query ( "SELECT * FROM dialog WHERE recive = $user_id OR send = $user_id ORDER by id DESC" );
$STH->setFetchMode ( PDO::FETCH_OBJ );
$row = $STH->fetch ();
$us_log1 = $row->send;
$us_log2 = $row->recive;
if ($us_log2 == $user_id) ($us_log2 = $us_log1);
$STH = $pdo->query ( "SELECT * FROM `users`);
$STH->setFetchMode ( PDO::FETCH_OBJ );
$users = $STH->fetchAll();
$STH = $pdo->query ( "SELECT * FROM dialog WHERE recive = $user_id OR send = $user_id ORDER by id DESC" );
$STH->setFetchMode ( PDO::FETCH_OBJ );
while ($row = $STH->fetchAll()) {
?>
<div class="dialogi">
<div id="123">отправитель <?=$users[$row->recive]->login?> получатель <?=$users[$row->send]->login?></b></div>
</div>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment