<?php
require_once("conn.php");
require_once("config.php");
require_once 'dbconfig4.php';
$userID=mysqli_real_escape_string($conn,$_GET['userID']);
$register_qury=mysqli_query($conn,"SELECT * FROM investregister WHERE reid='$userID'");
if(mysqli_num_rows($register_qury)>0){
$register_resalt=mysqli_fetch_array($register_qury);
?>
<div class="col-lg-4 col-md-6 col-sm-6 col-12">
										<div class="card">
											<div class="card-body">
												<div class="text-center">
													<div class="profile-photo">
													<?php if($register_resalt['image']==""){$pro_img="../profile/images/hd_dp.jpg";}else{$pro_img="../profile/uploadImg/".$register_resalt['image'];} ?><img src="<?php echo $pro_img; ?>" class="pro_pick">
													</div>
													<h3 class="mt-4 mb-1"><strong><?php echo $register_resalt['fullname']; ?></strong></h3>
													<p class="text-muted"><strong>Classes :- <?php
$sub_qury=mysqli_query($conn,"SELECT * FROM investreq_subject INNER JOIN investsubject ON investreq_subject.sub_req_sub_id=investsubject.sid WHERE sub_req_reg_no='$register_resalt[contactnumber]'");
while($sub_resalt=mysqli_fetch_array($sub_qury)){
?><?php echo $sub_resalt['name'],"<br>"; ?><?php } ?></strong></p>
													<ul class="list-group mb-3 list-group-flush">
														<li class="list-group-item px-0 d-flex justify-content-between">
															<span class="mb-0">Contact No. :</span><strong><?php echo "0".(int)$register_resalt['contactnumber']; ?></strong></li>
														<li class="list-group-item px-0 d-flex justify-content-between">
															<span class="mb-0">Grade :</span><strong><?php

						$id = $register_resalt['level']; 

						$query = $DB_con->prepare('SELECT name FROM investclass WHERE cid='.$id);

						$query->execute();

						$result = $query->fetch();

						echo $result['name'];

						 ?></strong></li>
														<li class="list-group-item px-0 d-flex justify-content-between">
															<span class="mb-0">Added Date. :</span><strong><?php echo $register_resalt['add_date']; ?></strong></li>
													</ul>
													<a class="btn btn-sm btn-success btn-rounded mt-3 px-4" href="chat.php?student=<?php echo $register_resalt["reid"]; ?>&name=<?php echo $register_resalt['fullname']; ?>"><i class="la la-comment-o"></i> Chat Now</a>
												</div>
											</div>
										</div>
									</div>
<?php
}
else{
	echo "<strong>Student Not Found</strong>";
}
?>