调用MySql存储过程时出现问题!
问题描述:
大家好!
我在调用MySql存储过程(Line4)时遇到问题:
Hi every one!
I have a problem with calling MySql store procedure (Line4):
class Category{
var $db;
function getCategory(){
$categoies=$this->db->query('Call get_category();'); //Line 4
//$categoies=$this->db->query('select * from category'); //Line 5
return $categoies;
}
}
$cate=new Category();
$cate->db=new mysqli('','root','abc','mydb');
$c=$cate->getCategory();
var_dump($c);
echo '<br />';
$c2=$cate->getCategory();
var_dump($c2);
问题是:
-如果我使用第4行,则变量$ c将是确定的(具有记录集),但是$ c2将是bool(false)
如果我使用第5行就可以了.
请帮助我,因为我需要使用存储过程!
谢谢!
The problem is that:
- If I use Line 4, variable $c will be OK (has record set), but $c2 will be bool(false)
If I use Line 5 is OK.
Please help me because I need to use store procedure!
Thanks!
答
db ; 函数getCategory(){
db; function getCategory(){
categoies =
categoies=
this-> db-> query(' 调用get_category();'); // 第4行 //
this->db->query('Call get_category();'); //Line 4 //