<?php
	require_once('Connections/conn_ama.php');

	if(!isset($_SESSION)){
        session_start();
    }


    	//Retrieve Galleries
    	$query_rsProjects = "SELECT projectID, ah, projtitle, projectdesc, dateadded, startdate, enddate, projectstatus  FROM projects ORDER BY dateadded DESC";
	    $rsProjects = mysqli_query($conn_ama, $query_rsProjects ) or die(mysqli_error($conn_ama));
	    $row_rsProjects = mysqli_fetch_assoc($rsProjects);
	    $totalRows_rsProjects = mysqli_num_rows($rsProjects);/**/
 ?>
<!-- <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>Project Title</th>
		                <th nowrap="nowrap">Date Created</th>

		                <th>Edit</th>
		                <th>Delete</th>
		            </tr>
		        </thead>

		        <tbody>
		        <?php do { ?>
		            <tr>
		                <td><a href="#" class="data-project" data-project="<?php echo $row_rsProjects['ah']; ?>"><?php echo $row_rsProjects['projtitle']; ?></a>	</td>
	                  	<td><?php echo date('d-m-Y', strtotime($row_rsProjects['dateadded'])); ?></td>
						<td><a href="#"
								class="projectedit"
								data-projectedit="<?php echo $row_rsProjects['projectID']; ?>"
								><i class="fas fa-edit"></i></a></td>
						<td><a href="#"
								class="projectdelete"
								data-projectdelete="<?php echo $row_rsProjects['projectID']; ?>"
								><i class="fas fa-times-circle fa-1x"></i></a></td>
		            </tr>
		        <?php } while($row_rsProjects = mysqli_fetch_assoc($rsProjects));?>

		    	</tbody>
		    </table>
		</div><!-- End .form-wrapper-->
	</div><!-- End .data-area-wrap-->
<!-- </div> -->

<script>

    $(document).ready( function() {
        $('#example').dataTable({
        	"pageLength": 10,
        	"order": []
        });
    });
</script>
