can someone help me here to solve an issue in php for unidentifid variable used in database
code is given below
<div class="single">
	 <div class="container">
		  <div class="col-md-8 single-main">				 
			  <div class="single-grid">
					<?php 
					$id = $_GET['id'];
					$db = new Db();	
					$data = $db->view($id);
					while($rec = $data->fetch_object()){
					echo "<img src='Postimages/'".$rec->image."'.jpg' alt=''/>";
					echo "<h1>".$rec->title."</h1><br>";
					echo "<p>".$rec->article."</p>";
					}
					?>					 					 
					</div>
			 <ul class="comment-list">
					<?php
					$db = new Db();
					$result = $db->admin();
					while($rec = $result->fetch_object()){
						
					?>	
		  		   <h5 class="post-author_head">Written by <a href="#" title="Posts by admin" rel="author"><b><?php echo $rec->name;?></b></a></h5>
		  		   <li><img src="images/<?php $rec->image?>.png" class="img-responsive" alt="">	
		  		   <div class="desc">
		  		   <p>View all posts by: <a href="#" title="Posts by admin" rel="author"><?php echo $rec->name;?></a></p>
		  		   </div>
				   <?php }?>
		  		   <div class="clearfix"></div>
		  		   </li>
		  	  </ul>
			  <div class="content-form">
					 <h3>Leave a comment</h3>
					<form action="comment.php" method="post">
						<?php
						if(!(isset($_SESSION['admin']))){ ?>
						<input type="text" name="email" placeholder="Email" required/>
						<input type="text" name="pass" placeholder="Password" required/>
							
						<?php } ?>
						<input type="hidden" name="post_id" value="<?=$_GET['id']?>" required/>
						<textarea placeholder="Message" name="comment"></textarea>
						<input type="submit" name="send" value="SEND"/>
				   </form>
				   <?php
					$id = $_GET['id'];
					$view = $db->commentview($id);
					while($rec = $view->fetch_object()){
					$id = 8;
				   ?>
				   <div class="comment_sec">
						<div class="col-md-12">
							<img src="images/avatar.png">
							<a href="#"><h3><?$rec->name?></h3></a><p><?php $rec->created_on?></p>
							<h5><?php $rec->comment?></h5>	
						</div>
				   </div>
				   <div class="clearfix"></div>
				   <?php
					}
					?>
						 </div>
		  </div>