how to get data from db using MySQL, PHP and PDO with AJAX
how to get data from db using MySQL, PHP and PDO with AJAX

I have about 8,000 test records and it takes too long to load into the table.
I understand that with ajax I could optimize this process, but I don't know how I can get data from my database, using datatables, PDO, PHP through ajax.
I would appreciate an example:
thanks:
this is the way i use to connect to the db and fetch the sql queries:
<?php
require_once "conectbd.php";
class ModelShowDt{
/********************************************************
SHOW DATAS
********************************************************/
static public function MdlMostrarMaterias($table, $item, $value){
if($item != null){
$stmt = Conexion::conect()->prepare("SELECT * FROM $tableWHERE $item = :$item");
$stmt -> bindParam(":".$item, $value, PDO::PARAM_STR);
$stmt -> execute();
return $stmt -> fetch();
}else{
$stmt = Conexion::conectar()->prepare("SELECT * FROM $tabla ORDER BY lote_piku_mp desc, viaje_mp ASC");
$stmt -> execute();
return $stmt -> fetchAll();
}
$stmt -> close();
$stmt = null;
}
}
// end class ModelShowDt
This discussion has been closed.
Replies
That's what Editor was made for! I recommend you get a license.I got one a few years ago. Amortization period was less than one day ...
https://editor.datatables.net/purchase/index?currency=gbp
See the examples here: https://editor.datatables.net/examples/index