当前位置:Gxlcms > PHP教程 > 基础函数求解释,该怎么处理

基础函数求解释,该怎么处理

时间:2021-07-01 10:21:17 帮助过:2人阅读

基础函数 求解释
function jieri($jieri){
$sql = "SELECT goods_id,goods_thumb,goods_name,shop_price,market_price FROM hc_goods WHERE goods_id in(SELECT goods_id FROM hc_goods_attr WHERE attr_value='".$jieri."') order by goods_id desc limit 5";
global $db;
$result = $db->getAll($sql);
return $result;
}
$sql="SELECT jieri_name FROM hc_shouye_jieri";
$result1 = $db->getAll($sql);

echo $a=$result1[0]['jieri_name'];//可以输出
$jieri1=jieri("$a");

print_r($jieri1);//这里打印不出

函数 print_r($jieri1);打印不出来啊 如果给 echo $a=$result1[0]['jieri_name']="赋值"就可以打印出了

这是怎么回事啊

------解决方案--------------------
function jieri($jieri){
echo $jieri; //看看是什么?
$sql = "SELECT goods_id,goods_thumb,goods_name,shop_price,market_price FROM hc_goods WHERE goods_id in(SELECT goods_id FROM hc_goods_attr WHERE attr_value='".$jieri."') order by goods_id desc limit 5";
global $db;
$result = $db->getAll($sql);
print_r($result); //看看有事什么?
return $result;
}

人气教程排行