mysql dbdriver call store procedure in codeigniter(ci)
<!-- php -->
$sql = "CALL .sp(@out1);";
$this->db->query($sql);
$query = $this->db->query("SELECT @out1");
$result_temp = array();
if($query->num_rows() > 0)
$result_temp = $query->result_array();
<!-- mysql -->
CREATE DEFINER=`id`@`ip` PROCEDURE `sp`(
OUT `last_id` INT
)
BEGIN
SET last_id = "test";
END$$
DELIMITER ;
<!-- codeigniter system/database/DB_active_rec.php -->
/**
* "Count All Results" query
*
* Generates a platform-specific query string that counts all records
* returned by an Active Record query.
*
* @param string
* @return string
*/
public function count_all_results($table = '')
{
if ($table != '')
{
$this->_track_aliases($table);
$this->from($table);
}
$sql = $this->_compile_select($this->_count_string . $this->_protect_identifiers('numrows'));
$query = $this->query($sql);
$result_temp = $query->result();
$array_temp = json_decode(json_encode($result_temp[0]), True);
$this->_reset_select();
if ($array_temp["numrows"] == 0)
{
return 0;
}
return (int) $array_temp["numrows"];
}
'php' 카테고리의 다른 글
json 동적 사용하기 (0) | 2016.05.31 |
---|---|
curl 없이 post 데이터 주고 받기 (0) | 2016.05.31 |
php 에서 _POST 대신 바로 변수명으로 데이터 전송 EGPCS (Environment, Get, Post, Cookie, and Server) (0) | 2013.10.22 |
13 permission denied access (0) | 2013.09.23 |
PHP 및 httpd.conf 내용중 기본적인 체크 (0) | 2013.08.16 |
댓글