I am doing is getting the url id to split the chatroom content but now i have error
here is my
chatMessage.php
include '../config.php';
include 'login.php';
$username = $_SESSION['id'];
$chatroomID =$_GET["chatroomID"];
$sql="SELECT * FROM chatroom_chat where chatroom_id ='$chatroomID'";
while ($row = mysqli_fetch_array($sql)) {
$chat = $row['chat_ID'];
$getChatData = "SELECT * FROM chat where id = $chat";
}
$sql1= "SELECT * FROM (
SELECT * FROM chat ORDER BY id DESC LIMIT 0,40
) sub
ORDER BY id ASC ";
$result = mysqli_query($connection, $sql1);
while($extract = mysqli_fetch_array($result)){
$color = ($extract['id'] == $username) ? '#FFFFFF' : '#66FFFF';
$position = ($extract['id'] == $username) ? 'right' : 'left';
$border = ($extract['id'] == $username) ? ' 1px solid black ' : ' none ';
echo "<div class='msg-dateandtime' style='text-align:$position; float:$position;'> <div class='left-username' style='color:blue;'>" . $extract['id'] ."</div>"
. "<div class='space'></div>"
. "<div class='right-date'> ". $extract['date'] ." </div></div>"
. "<div class='wrap-message' style='background-color:$color; border:$border; float:$position;'>"
. "<p style 'text-align=$position; margin:0; padding:0; text-align:left;'> ".$extract['chat']."</p></div>";
}
i have no idea where goes wrong