【发布时间】:2014-03-18 11:23:39
【问题描述】:
我创建了两个函数,我想从第一个函数中获取 location_4 值作为 $id 并将其值数组传递给第二个函数我如何做到这一点?这是我的代码:
function getbussinessdetail($profit_id)
{
$select="select a.account_id,a.title,a.budget,a.location_4,a.renewal_date,l.name from listing a,listinglevel l where l.value=a.level and profit_instructor_id='".$profit_id."' group by a.account_id";
$result = $GLOBALS ['mysqli']->query ($select) or die ($GLOBALS ['mysqli']->error . __LINE__);
while($rs=$result->fetch_assoc ())
{
$res[]=$rs;
}
return $res;
}
function getCityName($id)
{
if($id>0)
{
$select="select name from Location_4 where id=$id";
$result = $GLOBALS ['mysqli1']->query ($select) or die ($GLOBALS ['mysqli1']->error . __LINE__);
$rs=$result->fetch_assoc ();
return $rs['name'];
}
}
【问题讨论】: