I have created below store procedure
Calling This Store Procedure
I have error this page
2014 - Commands out of sync; you can't run this command now
call `sp_search_bos_user_master`('last_login', 'DESC', '0', '20', '2') :dunno:
Regards,
Asif
PHP:
<?php
BEGIN
SET @sortfield = str_sortfield;
SET @sortorder = str_sortorder;
SET @min_limit = str_min_limit;
SET @max_limit = str_max_limit;
IF which_query_fired = '1' THEN
SELECT count(*) as 'count' from bos_user_master;
ELSEIF which_query_fired = '2' THEN
SET @dynamic_sql=CONCAT("SELECT bos_user_master_id,username,user_fullname,user_type,");
SET @dynamic_sql=CONCAT(@dynamic_sql, "date_format(last_login,'%d, %b %Y') as login, date_format(add_bos_user_date,'%d, %b %Y') as add_date from bos_user_master");
IF @sortfield != 0 THEN
SET @dynamic_sql=CONCAT(@dynamic_sql, " ORDER BY ",@sortfield," ",@sortorder);
END IF;
SET @dynamic_sql=CONCAT(@dynamic_sql, " LIMIT ", @min_limit, ",", @max_limit);
PREPARE complete_sql FROM @dynamic_sql;
EXECUTE complete_sql;
DEALLOCATE PREPARE complete_sql;
END IF;
END
?>
PHP:
<?php
/**** Write Store Procedure for Bos User Master Select *****************************/
$query = "call `".$this->procedure_name."`('".$this->sortField."', '".$this->sortOrder."', '".$this->findStartPost()."', '".$this->paging_limit."', '1')";
/**** Call Store Procedure Query *****************************/
$recresult_count = $db->db_query($query,"sp");
/********* START Record Fetch No. of Rows *********************/
$obj_row = $db->db_fetch_row($recresult_count);
$int_count = $obj_row[0];
$db->db_free_result($recresult_count);
/**** Write Store Procedure for Bos User Master Select *****************************/
$query = "call `".$this->procedure_name."`('".$this->sortField."', '".$this->sortOrder."', '".$this->findStartPost()."', '".$this->paging_limit."', '2')";
/**** Call Store Procedure Query *****************************/
$recresult = $db->db_query($query,"sp");
/********* START Record Fetch No. of Rows *********************/
$page_total = $db->db_num_rows($recresult);
?>
2014 - Commands out of sync; you can't run this command now
call `sp_search_bos_user_master`('last_login', 'DESC', '0', '20', '2') :dunno:
Regards,
Asif