EasyUI Forum
September 15, 2025, 03:28:21 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: call store procedure  (Read 4979 times)
irn-id
Newbie
*
Posts: 1


View Profile
« 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..


Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!