<?php 
	require_once('Connections/conn_ama.php');
	
	if(!isset($_SESSION)){
        session_start();
    }
    	

    	//Retrieve News Articles
    	$query_rsNews = "SELECT newsID, ah, headline, gist, content, dateAdded  FROM v_newsarticles  ORDER BY dateAdded DESC";
	    $rsNews = mysqli_query($conn_ama, $query_rsNews ) or die(mysqli_error($conn_ama));
	    $row_rsNews = mysqli_fetch_assoc($rsNews);
	    $totalRows_rsNews = mysqli_num_rows($rsNews);/**/
 ?>
<!-- <div class="col-md-9 data-area"> -->
	<div class="mreport-steps">
		<?php //include("mreport-steps.inc.php"); ?>
	</div><!-- End .mreport-step-->
	<div class="data-area-wrap">
		<div class="form-wrapper">
			<table id="example" class="table" cellspacing="0" width="100%">
		        <thead>
		            <tr>
		                <th>Headline</th>
		                <!-- <th>Category</th> -->
		                <!-- <th>Postion</th> -->
		                <th nowrap="nowrap">Date Created</th>
		                <!-- <th>Country</th> -->
		                <th>Edit</th>
		                <th>Delete</th>
		            </tr>
		        </thead>

		        <tbody>
		        <?php do { ?>
		            <tr>
		                <td><?php echo $row_rsNews['headline']; ?></td>
	                  	<td ><?php echo $row_rsNews['dateAdded']; ?></td>
	                    <td align="center"><a href="#" class="newsedit" data-newsedit="<?php echo $row_rsNews['ah']; ?>"><i class="fas fa-edit"></i></a></td>
		                <td align="center"><a  href="#" class="newsdelete" data-newsdelete="<?php echo $row_rsNews['ah']; ?>"><i class="fas fa-times-circle fa-1x"></i></a></td>
		            </tr>
		        <?php } while($row_rsNews = mysqli_fetch_assoc($rsNews));?>
		            
		    	</tbody>
		    </table>
		</div><!-- End .form-wrapper-->
	</div><!-- End .data-area-wrap-->	
<!-- </div> -->

<script>

    $(document).ready( function() {
        $('#example').dataTable({
        	"pageLength": 10,
        	"order": []
        });
	});
	
	/* function DeleteConfirmation()
	{
		if (confirm("Are you sure, you want to delete the news item?")==true)		
		return true;
			else
		return false;
	} */

</script>