Good people, I have been presented with this error and I have not been able to solve it, I hope you can help me:
This is my PHP code in which I get my DB records
include ("conexion.php");
$query = "SELECT * FROM ciclos;";
$resultado = mysqli_query($conexion, $query);
if (!$resultado){
die("Error");
}else{
$array["data"] = [];
while( $data = mysqli_fetch_assoc($resultado)){
$arreglo["data"][] = array_map("utf8_encode",$data);
}
echo json_encode($arreglo);
}
mysqli_free_result($resultado);
mysqli_close($conexion);
?>
This is my code that I have in the HTML:
<script>
$(document).on("ready", function(){
listar();
});
var listar = function(){
var table = $("#ciclos").DataTable({
"ajax":{
"method":"POST",
"url": "listar.php"
},
"colums":[
{"data":"ciclo"},
{"data":"fecha_inicio"},
{"data":"fecha_termino"}
],
"language" : idioma_espaniol
});
}
var idioma_espaniol = {
"sProcessing": "Procesando...",
"sLengthMenu": "Mostrar _MENU_ registros",
"sZeroRecords": "No se encontraron resultados",
"sEmptyTable": "Ningún dato disponible en esta tabla",
"sInfo": "Mostrando registros del _START_ al _END_ de un total de _TOTAL_ registros",
"sInfoEmpty": "Mostrando registros del 0 al 0 de un total de 0 registros",
"sInfoFiltered": "(filtrado de un total de _MAX_ registros)",
"sInfoPostFix": "",
"sSearch": "Buscar:",
"sUrl": "",
"sInfoThousands": ",",
"sLoadingRecords": "Cargando...",
"oPaginate": {
"sFirst": "Primero",
"sLast": "Último",
"sNext": "Siguiente",
"sPrevious": "Anterior"
},
"oAria": {
"sSortAscending": ": Activar para ordenar la columna de manera ascendente",
"sSortDescending": ": Activar para ordenar la columna de manera descendente"
}
}
</script>
HTML code of the table:
<div class="row">
<div id="cuadro1" class="col-sm-12 col-md-12 col-lg-12">
<div class="col-sm-offset-2 col-sm-8">
<h3 class="text-center"> <small class="mensaje"></small></h3>
</div>
<div class="table-responsive col-sm-12">
<table id="ciclos" class="table table-bordered table-hover" cellspacing="0" width="100%">
<thead>
<tr>
<th>Ciclo</th>
<th>Fecha de Termino</th>
<th>Fecha de Inicio</th>
<th></th>
</tr>
</thead>
</table>
</div>
</div>
</div>
The file listar.php shows the data:
The message that is thrown is the following: