Вот мой код. Мой поиск не работает и Edit
показывает, но не сохраняет в базе данных! Я пробовал то, что в этом URL, http://www.trirand.com/jqgridwiki/doku.php?id=wiki%3asinge_searching. Но я не мог исправить это. Как я могу решить эту проблему?
<SCRIPT type="text/javascript">
$(function(){
jQuery("#list1").jqGrid({
url:'school_manager_db.php?q=1',
datatype: "xml",
colNames:['ID','Name', 'City', 'Email','Tel NO','Type','Notes'],
colModel:[
{name:'id',index:'school_id', width:65,},
{name:'name',index:'school_name', width:290,editable: true},
{name:'city',index:'city', width:130,editable: true},
{name:'email',index:'email', width:130,editable: true, align:"right"},
{name:'tel',index:'contact', width:130,editable: true, align:"right"},
{name:'type',index:'type', width:80,editable: true,edittype: 'select',
align:"right"},
{name:'note',index:'note', width:150,editable: true, sortable:false}
],
height:480,
rowNum:10,
rowList:[40,80,120],
imgpath: '/images',
pager: jQuery('#pager1'),
sortname: 'id',
viewrecords: true,
sortorder: "desc",
caption:'',
editurl:"someurl.php"
}).navGrid('#pager1',{
edit:true,
add:true,
del:true
});
jQuery("#list1").searchGrid( options );
});
</SCRIPT>
Моя страница PHP,
<?php
include("db.php");
$page = $_GET['page']; // Get the requested page.
$limit = $_GET['rows']; // Get how many rows we want to have into the grid.
$sidx = $_GET['sidx']; // Get index row - i.e. user click to sort.
$sord = $_GET['sord']; // Get the direction.
if (!$sidx)
$sidx =1;
$result = mysql_query("SELECT COUNT(*) AS count FROM school");
$row = mysql_fetch_array($result,MYSQL_ASSOC);
$count = $row['count'];
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 school_id, school_name,school_bedge,city,contact, email,typ from school ORDER BY $sidx $sord LIMIT $start , $limit";
$result = mysql_query( $SQL ) or die("Couldn?t execute query.".mysql_error());
if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") )
{
header("Content-type: application/xhtml+xml;charset=utf-8");
}
else
{
header("Content-type: text/xml;charset=utf-8");
}
$et = ">";
echo "<?xml version='1.0' encoding='utf-8'?$et\n";
echo "<rows>";
echo "<page>".$page."</page>";
echo "<total>".$total_pages."</total>";
echo "<records>".$count."</records>";
// Be sure to put text data in CDATA.
while($row = mysql_fetch_array($result,MYSQL_ASSOC))
{
echo "<row id='". $row[id]."'>";
echo "<cell>". $row['school_id']."</cell>";
echo "<cell>". $row['school_name']."</cell>";
echo "<cell>". $row['city']."</cell>";
echo "<cell>". $row['email']."</cell>";
echo "<cell>". $row['contact']."</cell>";
echo "<cell>". $row['typ']."</cell>";
echo "<cell><![CDATA[". $row[note]."]]></cell>";
echo "</row>";
}
echo "</rows>";
?>