基础函数 求解释,该怎么处理
程序员文章站
2024-01-03 11:18:40
...
基础函数 求解释
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;
}
相关文章
相关视频
- 两款万能的php分页类,两款php分页_PHP教程
- php生成图片缩略图的方法,_PHP教程
- PHP4.0.1的变化(三)_PHP教程
- PHP 编码规范(9)_PHP教程
- 基础函数 求解释,该怎么处理