The list of all communications is normal, and with the full version of the communication, the problem is closed.



  • Visits to the open session site. So there's a file. mes.php - A list of all short-circuited messages (this file is good) and there's a file. full_mes.php - full version of the message. I mean, on the mes.php page, you click on the cut text and you hit it. full_mes.php где должна показываться полная версия сообщения

    The problem is, to keep the scouts from changing, I send messages to myself. And the last message I'm sending is, in a full version, looks normal, and all the messages I've received before, they're displaying the last message sent.

    I know where the problem is, but I don't know how to solve it. The problem with the file. full_mes.php♪ Here's the line of the code that's responsible for extracting the message:

    $tmp = mysql_query("SELECT * FROM messages WHERE poluchatel='$login' ORDER BY id DESC,$db); $messages = mysql_fetch_array($tmp);

    Note: $login = $_SESSION['login']; i.e. the logic for the open session. Table field messages:

    1. id (auto_increment)
    2. author
    3. poluchate
    4. text
    5. view
    6. date

    I understand that the request for ORDER BY id DESC is unnecessary, but without this, it makes a mistake on the page. In fact, the request is working on how he's supposed to work, sorting id messages and pulling out the last one, that's how to solve this problem?



  • When you look at the list, the reference to the full version should be id of the message, an example.

    <a href="?view=full&id=<?=$msg->id?>"><?=msg->text?></a>
    

    And in the request, it should be used.

    $id = (int)@$_GET['id'];
    if ($id > 0) {
      $res = mysql_query('SELECT * FROM messages WHERE poluchatel=\''.$login.'\' AND id='.$id.';');
      if (!!$msg = mysql_fetch_object($msg)) {
        // тут можно работать с объектом $msg
        } else die('Такого сообщения нет'); // подразумевается, что если получатель - не вы, его тоже показывать не надо.
      }
    

    You know, as such, he's not gonna show up. If you need to, add it to the reference. &out=1 And look, before you ask, $_GET['out'] If it's not empty, check the consignor's field.WHERE author=\''.$login.'\' AND id='.$id.';')




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2