多个规格、品牌,拼起来 "品牌1和品牌2和",去最后一个连接字符

本文介绍了一种使用PHP从数据库中高效查询品牌信息的方法。通过分析查询过程,实现了对特定条件下品牌数据的有效获取,并展示了如何处理查询结果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >



//品牌名称
			    $brandnames = explode(',',M ( 'goodspromotion' )->order('rule_1')->where ("state = 1 and rule_style= 3")->getField('promotion_goods'));
			    $count_brandnu = count($brandnames);
			    for($start=0;$start<$count_brandnu;$start++){
			    	
			    	$brandname =  M ( 'brand' )->where ("id =  $brandnames[$start]")->getField('brand_name').'和'.$brandname;
			    		
			    }
			  
			    $brandname = substr($brandname,0,strlen($brandname)-3); //UTF类型 在数据库一个汉字占3个字节


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值