<?php

require __dir__ . '/init.php';

template::get_header();

?>
  
	<?php template::title('Edit Details'); ?>
	
	<div class='card'>
		<div class="card-body">
			<div class="table-responsive">
				<table class="display table"  id="example">
					<thead>
						<tr>
							<th>ACCOUNT NAME</th>
							<th>EMAIL</th>
							<th>PHONE</th>
							<th>REG-DATE </th>
							<th>ACTION</th>
						</tr>
					</thead>
					<tbody>
						<?php 
						
							$sql= "SELECT * FROM tbl_users";
							$result = mysqli_query($link,$sql);
							
							if(mysqli_num_rows($result) > 0){
								while($row = mysqli_fetch_assoc($result)):
									
							?>
						<tr class="odd gradeX">
							<td><?php echo $row['fname'] .' '. $row['lname'];?></td>
							<td><?php echo $row['email'];?></td>
							<td><?php echo $row['phone'];?></td>
							<td><?php echo $row['bdate'];?></td>
							<td> 
								<a href="user-edit.php?email=<?php echo $row['email']?>"> 
									<button type="submit" name="edit" class="btn btn-primary">
										<span class="fa fa-pencil-alt"></span> Edit
									</button>
								</a>
							</td>
						</tr>
						<?php    
								endwhile;
							}
							?>
					</tbody>
				</table>
			</div>
		</div>
	</div>
	
<?php template::get_footer(); ?>
