<?php

    session_start();

	include "db_connect.php";

    $logUserid = mysqli_real_escape_string($con,$_POST['logUserid']);
    $chatBot = 1100;

    $createToday = new DateTime('now', new DateTimeZone('Asia/Colombo'));
	$date= $createToday->format('Y-m-d');
	$time= $createToday->format('H:i:s');
    $datetime = $date." ". $time;

    echo $sql1 = "SELECT * FROM chat_details WHERE logUserid = $logUserid AND chatBot = $chatBot AND `date` = '$date' ORDER BY id";
    $result1 = mysqli_query($con,$sql1) or die(mysqli_error($con));
    while($row1 = mysqli_fetch_array($result1)){

        $type = $row1['type'];

        if($type == 's'){
        ?>
            <div class="row msg_container base_sent">
				<div class="col-md-10 col-xs-10" style="padding:0;">
					<div class="messages msg_sent">
						<p><?php echo $row1['msg']; ?></p>
						<time datetime="2009-11-13T20:00">User • <?php echo $row1['time']; ?></time>
					</div>
				</div>
				<div class="col-md-2 col-xs-2 avatar" style="padding:0;">
					<img src="./images/chatMan.png" class="chatimg img-responsive ">
				</div>
			</div>
        <?php
        } else if ($type == 'r') {
        ?>

            <div class="row msg_container base_receive">
				<div class="col-md-2 col-xs-2 avatar" style="padding:0;">
					<img src="./images/chatTrain.png" class="chatimg img-responsive ">
				</div>
				<div class="col-md-10 col-xs-10" style="padding:0;">
					<div class="messages msg_receive">
						<p><?php echo $row1['msg']; ?></p>
						<time datetime="2009-11-13T20:00">Railbot • <?php echo $row1['time']; ?></time>
					</div>
				</div>
			</div>

        <?php
        }

    }





?>