The plug-in group is easy to use, the following is a query from the front to submit the conditions, from the MSSQL return JSON data a case
HTML Front-End Code
Copy Code code as follows:
<?php
Include_once ("auth.php");
?>
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<link rel= "stylesheet" type= "Text/css" href= "/inc/js/easyui/themes/default/easyui.css" >
<link rel= "stylesheet" type= "Text/css" href= "/inc/js/easyui/themes/icon.css" >
<script type= "Text/javascript" src= "/inc/js/easyui/jquery-1.8.0.min.js" ></script>
<script type= "Text/javascript" src= "/inc/js/easyui/jquery.easyui.min.js" ></script>
<script>
function FindData () {
$ (' #mytable '). DataGrid (' Load ', {
personcode:$ (' #PersonCode '). Val (),
kqym:$ (' #KQYM '). Val ()}
);
}
</script>
<body>
<table id= ' mytable ' class= ' easyui-datagrid ' style= ' width:600px;height=500px '
Url= "loadgriddata_get.php" title= "Please enter query criteria"
Rownumbers= "true" toolbar= "#searchtool loadmsg=" is querying ... ">
<thead>
<tr>
<th field= "Personcode" Width= "No." > Work </th>
<th field= "myname" width= "no" > Name </th>
<th field= "Kqdate" width= "M" > Attendance date </th>
<th field= "Myweek" width= "> Week </th>"
<th field= "Kqmemo" width= "> Clocking time </th>
</tr>
</thead>
</table>
<div id= "Searchtool" style= "padding:5px" >
<span> work Number: </span><input type= "text" id= "Personcode" value= "" size=10/>
<span> Attendance: </span><input type= "text" id= "Kqym" value= "" size=10/>
<a href= "Javascript:finddata ()" class= "Easyui-linkbutton" data-options= "iconcls: ' Icon-search '" > Query </a>
<div>
</body>
The following is a dataset and assembles the data into a JSON object to return the PHP code to the foreground
Copy Code code as follows:
<?php
Include_once ("auth.php");
Include_once ("inc/ms_conn.php");
Include_once ("inc/comm_function.php");
$PersonCode =$_post["Personcode"]; The parameters that came from the front
$KQYM =$_post["Kqym"];
$sqlstr = "Exec dbo.hr_prg_getpersonymkq2 ' $KQYM ', ' $PersonCode '";
$rs =mssqlquery ($SQLSTR); Custom MSSQL method, class quasi Mssql_query method
$row = Mssql_num_rows ($RS); Number of rows taken
$result ["total"] = $row;
$items =array ();
while ($row = Mssql_fetch_array ($rs)) {
foreach ($row as $key => $value) {
It's important here that PHP's json_encode only supports UTF-8, otherwise the Chinese character field values are set to NULL
$row [$key]=iconv (' gb2312 ', ' UTF-8 ', $row [$key]); }
Array_push ($items, $row); }
$result ["Rows"] = $items;
echo Json_encode ($result);
?>
The following is an effect chart