i m debuting with jqgrid and i found it intersting so i started working with it but it was not a good strat i v got always an empty grid
this is a code html index.html
My First Grid
and this the php fileÂ
$page = $_GET; // get the requested page
$limit = $_GET; // get how many rows we want to have into the grid
$sidx = $_GET; // get index row – i.e. user click to sort
$sord = $_GET; // get the direction
if(!$sidx) $sidx =1;
// connect to the database
$db = mysql_connect(“localhost”, “rot”, “”)or die(“Connection Error: ” . mysql_error());mysql_select_db(“recrutement”) or die(“Error conecting to db.”);
$result = mysql_query(“SELECT COUNT(*) AS count FROM license a, license b WHERE a.id_dossier=b.id_dossier”);
$row = mysql_fetch_array($result,MYSQL_ASSOC);
$count = $row;if( $count >0 ) {
$total_pages = ceil($count/$limit);
} else {
$total_pages = 0;
}
if ($page > $total_pages) $page=$total_pages;
$start = $limit*$page – $limit; // do not put $limit*($page – 1)
$SQL = “SELECT id_dossier, cin, codecin, nom_prenom, date_naiss,lieu_naiss, sexe FROM license ORDER BY $sidx $sord LIMIT $start , $limit”;
$result = mysql_query( $SQL ) or die(“Couldn t execute query.”.mysql_error());$responce->page = $page;
$responce->total = $total_pages;
$responce->records = $count;
$i=0;
while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
$responce->rows[$i]=$row[id_dossier];
$responce->rows[$i]=array($row[id_dossier],$row[cin],$row[codecin],$row[nom_prenom],$row[date_naiss],$row[lieu_naiss],$row[sexe]);
$i++;
}
header(“Content-Type: application/json; charset=utf-8”);echo json_encode($responce);
?>
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top