Php jqGrid搜索不工作

Php jqGrid搜索不工作,php,jquery,jqgrid,Php,Jquery,Jqgrid,这是我的密码。我的搜索不起作用,Edit正在显示,但没有保存到数据库中!我尝试了此URL中的内容。但我无法纠正它。我如何解决这个问题 <SCRIPT type="text/javascript"> $(function(){ jQuery("#list1").jqGrid({ url:'school_manager_db.php?q=1', datatype: "xml", colName

这是我的密码。我的搜索不起作用,
Edit
正在显示,但没有保存到数据库中!我尝试了此URL中的内容。但我无法纠正它。我如何解决这个问题

<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>

$(函数(){
jQuery(“#list1”).jqGrid({
url:'school\u manager\u db.php?q=1',
数据类型:“xml”,
colNames:['ID','Name','City','Email','telno','Type','Notes',],
colModel:[
{名称:'id',索引:'school_id',宽度:65,},
{name:'name',index:'school_name',宽度:290,可编辑:true},
{名称:'city',索引:'city',宽度:130,可编辑:true},
{名称:'email',索引:'email',宽度:130,可编辑:true,对齐:“right”},
{名称:'tel',索引:'contact',宽度:130,可编辑:true,对齐:“right”},
{名称:'type',索引:'type',宽度:80,可编辑:true,可编辑类型:'select',
对齐:“右”},
{名称:'note',索引:'note',宽度:150,可编辑:true,可排序:false}
],
身高:480,
rowNum:10,
行列表:[40,80120],
imgpath:“/images”,
寻呼机:jQuery(“#pager1”),
sortname:'id',
viewrecords:是的,
巫师:“描述”,
标题:'',
editurl:“someurl.php”
}).navGrid(“#第1页”{
编辑:对,
加:是的,
德尔:是的
});
jQuery(“列表1”).searchGrid(选项);
});
我的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>";
?>

查看搜索时发送到服务器的参数,并修改PHP以做出相应响应。不是PHP专家(我在Ruby中使用jqGrid),但应该是以下几点:

if $search="true" {
    if $name {
       $where_clause = "where name = $name"
    }
}

$SQL = "SELECT school_id, school_name,school_bedge,city,contact, email,typ from school  $where_clause ORDER BY $sidx $sord LIMIT $start , $limit";

问题可能出在您使用的“类型”列中
edittype:select
。尝试替换以下代码:

{name:'type',index:'type', width:80,editable: true, search: false, edittype: 'select',
                align:"right"},

我只需要一行搜索,它与导航搜索集成在一起