title: How to work on jqgrid Add, edit, delete? using php
body: <p>how to work on add row, edit, del the row in jqgrid? how to invoke editurl??</p>
  
  <p>my code is below... jqgrid.php page.</p>
  
  <pre><code> var $mygrid= jQuery("#list").jqGrid({
                          url:'example.php',                                           
                          datatype: 'xml',
                          mtype: 'GET',
                          colNames:['Seq','Name', 'ID','Pass','Mail','Note'],
                          colModel :[ 
                          {name:'seq',index:'seq', width:55, resizable:false, editable:true, editoptions:{readonly:true,size:10}}, 
                          {name:'name',index:'name', width:90,resizable:false, editable:true, editoptions:{readonly:false,size:10}}, 
                          {name:'id',index:'id', width:80, align:'right', editable:true, editoptions:{readonly:false,size:10}}, 
                          {name:'pass',index:'pass', width:80, align:'right', sortable:false, editable:true, editoptions:{readonly:false,size:10}}, 
                          {name:'mail',index:'mail', width:80,align:'right', sortable:false, editable:true, editoptions:{readonly:false,size:10}}, 
                          {name:'id',index:'id', width:150, sortable:false} ],                            
                          pager: jQuery('#pager'),
                          rowNum:10,
                          rowList:[10,20,30,50],
                          sortname: 'seq',
                          sortorder: "Asc",
                          width: 1000,
                          height: 230,                                                                            
                          viewrecords: true,
                          multiselect: true,
                          editable: true,
                          toolbar: [true,"top"],                            
                          multikey: "ctrlKey",                           
                          editurl:'add.php',                           
                          caption: 'staff'
  
  
          });
              $("#list").jqGrid('navGrid', '#pager', {
                       edit: true,                    
                       add: true,                             
                       del: true,                     
                       search: false,                      
                       refresh:false
               })
  </code></pre>
  
  <p>});</p>
  
  <p>And example.php code is</p>
  
  <pre><code>enter code here  &lt;?php
                       $dbhost = 'localhost';
                       $dbuser = 'test';
                       $dbpassword = 'test';
                       $database = 'cs_test';
  
                       $page = $_GET['page'];
                      // get how many rows we want to have into the grid - rowNum parameter in the grid
                       $limit = $_GET['rows'];
                      // get index row - i.e. user click to sort. At first time sortname parameter -
                      // after that the index from colModel
                      $sidx = $_GET['sidx'];
  
                       // sorting order - at first time sortorder
                       $sord = $_GET['sord'];
                       // if we not pass at first time index use the first column for   the index or what you want
                      if(!$sidx) $sidx =1;
                      // connect to the MySQL database server
                      $db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error());
                     // select the database
                     mysql_select_db($database) or die("Error conecting to db.");
                     // calculate the number of rows for the query. We need this to paging the result
                      $result = mysql_query("SELECT COUNT(*) AS count FROM TM_Staff");
                      $row = mysql_fetch_array($result,MYSQL_ASSOC);
                      $count = $row['count'];
                      // calculation of total pages for the query
                      if( $count &gt; 0 ) {
                  $total_pages = ceil($count/$limit);
                  //$total_pages = 20;
                      } else {
                   $total_pages = 0;
                      }
                      if ($page &gt; $total_pages) $page=$total_pages;
                          $start = $limit*$page - $limit;
                          if($start&lt;0) $start = 0;
                         // the actual query for the grid data
                          $SQL = "SELECT seq,name,id,pass,mail,ins_dt from TM_Staff 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");
                         }
                         echo "&lt;?xml version='1.0' encoding='utf-8'?&gt;";
                         echo "&lt;rows&gt;";
                         echo "&lt;page&gt;".$page."&lt;/page&gt;";
                         echo "&lt;total&gt;".$total_pages."&lt;/total&gt;";
                         echo "&lt;records&gt;".$count."&lt;/records&gt;";
                         // be sure to put text data in CDATA
                         while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
                          echo "&lt;row id='". $row[seq]."'&gt;";
                          echo "&lt;cell&gt;". $row[seq]."&lt;/cell&gt;";
                          echo "&lt;cell&gt;". $row[name]."&lt;/cell&gt;";
                          echo "&lt;cell&gt;". $row[id]."&lt;/cell&gt;";
                              echo "&lt;cell&gt;". $row[pass]."&lt;/cell&gt;";
                          echo "&lt;cell&gt;". $row[mail]."&lt;/cell&gt;";
                          echo "&lt;cell&gt;&lt;![CDATA[". $row[id]."]]&gt;&lt;/cell&gt;";
                          echo "&lt;/row&gt;";
                          }
                          echo "&lt;/rows&gt;";
        ?&gt;
  </code></pre>
  
  <p>plz help me, im in trouble...</p>