An array containing the primary key values of a mysql table will be passed through an ajax call to a php page and from the php page, rows with the primary keys in the array will be updated
js snippet:
<script type="text/javascript">
$(document).ready(function(){
var my_array=[1,2.,4,5,6];
$.post("array_post.php",{
my_array:my_array
},function(response){
alert(response);
}
);
});
</script>
'id' is the primary key. array_post.php has :
$my_array=$_POST['my_array'];
$sql="UPDATE my_table SET my_col=1 WHERE id IN ($my_array)";
Bu that shows error.
I need the solution.