简体   繁体   中英

How to display message using bootstrap?

I'm doing a chat, and I want to display the messages, namely display the name and the message on each row. the problem is the messages are on the left side. In my opinion, I did something wrong with the boostrap, could someone look at the code and see where the error is, because in my opinion it should work but it does not work. But I have yet a question, I want to change background if last_name is Smith, but now show error about if This is my code

 <main> <div class="container"> <?php $str = new display_message($object); $bot = $str->message(); ?> <div class="row"> <div class="col-xl-12"> <form action="" method="post"> <input type="text" name="message"> <button id="send" name="send">Send</button> </form> </div> </div> </div> </main>

 if($sql->rowcount()) { while($row= $sql->fetch()) { echo '<div class="row mb-2" id="rows" style="background-color:if($row['last_name']=='Smith'){echo red;}else{ echo blue;}">'; echo '<div class="col-xl-2">'; echo $row['last_name']; echo '</div>'; echo '<div class="col-xl-2">'; echo $row['message']; echo '</div>'; echo '</div>'; echo '</div>'; } }

last division close tag is breaking your code.

                echo '</div>';
                echo '</div>'; //remove this

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM