EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: irn-id on July 09, 2014, 08:32:29 PM



Title: call store procedure
Post by: irn-id on July 09, 2014, 08:32:29 PM
haii all,

how to call store procedure,

this my code:

store procudure mysql:
name cus1

begin
  select * from customer where cusdate>=startdate and cusdate<=endate
end

name cus2

begin
  select count(*) from customer where cusdate>=startdate and cusdate<=endate
end


my data grid..:

$page = isset($_POST['page']) ? intval($_POST['page']) : 1;
$rows = isset($_POST['rows']) ? intval($_POST['rows']) : 20;
$sort = isset($_POST['sort']) ? strval($_POST['sort']) : 'datein';
$order = isset($_POST['order']) ? strval($_POST['order']) : 'asc';

   $offset = ($page-1)*$rows;   
   $result = array();
   $rs = mysql_query("CALL cus2('$starfrom','$endfrom')");
   $row = mysql_fetch_row($rs);
   $result["total"] = $row[0];
   
   $rs = mysql_query("CALL cus1('$starfrom','$endfrom'), order by $sort $order limit $offset,$rows");   
   $rows = array();
   while($row = mysql_fetch_object($rs)){
      array_push($rows, $row);
   }
   $result["rows"] = $rows;   
   echo json_encode($result);

i try ,..but data grid = empty

please..help..

thx..