<?php

include_once("_config_.php");

$conf = new config();

$action = mysqli_real_escape_string($conf->_conni(), $_POST['action']); 
$updateRecordsArray = $_POST['recordsArray'];

if ($action == "updateRecordsListings"){
	
	$listingCounter = 1;
	foreach ($updateRecordsArray as $recordIDValue) {
		
		$query = "UPDATE copn_cpnbnks SET _copn_stdat = " . $listingCounter . " WHERE cpn_id = " . $recordIDValue;
		mysqli_query($conf->_conni(), $query) or die('Error, insert query failed');
		$listingCounter = $listingCounter + 1;	
	}
	
	echo '<pre>';
	print_r($updateRecordsArray);
	echo '</pre>';
	
}
?>
