我的私人讯息未显示预期结果

时间:2019-05-02 11:55:23

标签: php

代码有效,但是有一些错误我无法弄清

这是私人消息,接收者可以收到消息,但发件人看不到他们发送的消息

<div class="load_msg" id="scroll">
        <?
            $sel_msg = "SELECT * FROM user_messages WHERE (user_to='$user_to_msg' AND user_from='user_from_msg') OR (user_from='$user_to_msg' AND user_to='$user_from_msg') ORDER by 1 ASC";
            $run_msg=mysqli_query($con,$sel_msg);


            while ($row_msg = mysqli_fetch_array($run_msg)) {

                $user_to = $row_msg['user_to'];
                $user_from = $row_msg['user_from'];
                $msg_body = $row_msg['msg_body'];
                $msg_date = $row_msg['date'];
                ?>
                <div id="loaded_msg">
                    <p>
                    <?php
                    if($user_to == $user_to_msg AND $user_from == $user_from_msg){
                        echo "<div class='message' id='blue' data-toggle='tooltip' title='$msg_date'>$msg_body</div><br><br><br>";}
                    else if($user_from == $user_to_msg and $user_to == $user_from_msg){
                        echo "<div class='message' id='green' data-toggle='tooltip' title='$msg_date'>$msg_body</div><br><br><br>";
                    } 
                    ?>
                    </p>
                </div>
                <?

            } 
        ?>
    </div>

我希望收到类似消息系统的输出,但是只有绿色的出现

0 个答案:

没有答案