基础函数 求解释,该怎么处理
程序员文章站
2022-05-28 19:13:10
...
基础函数 求解释
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;
}
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;
}
相关文章
相关视频
- 详解win10下PHP的安装配置(以php5.6为...
- php Swoole实现毫秒定时计划任务(详解)
- PHP中的一些经验积累_PHP教程
- php入门教程 精简版_PHP教程
- 基础函数 求解释,该怎么处理