|
@@ -123,13 +123,22 @@ if ($result && $result->num_rows > 0) {
|
|
|
</div>
|
|
|
<div class="col6">
|
|
|
<?php
|
|
|
- // 使用SQL拼接方式
|
|
|
- $cs_type = intval($row['cs_type']);
|
|
|
- $typeResult = $conn->query("SELECT businessType FROM clienttype WHERE id = " . $cs_type);
|
|
|
- if ($typeRow = $typeResult->fetch_assoc()) {
|
|
|
- echo htmlspecialcharsFix($typeRow['businessType']);
|
|
|
+ // 使用JOIN查询一次性获取所有业务类型
|
|
|
+ $businessTypes = $conn->query("
|
|
|
+ SELECT ct.businessType
|
|
|
+ FROM customer_business_type cbt
|
|
|
+ JOIN clienttype ct ON cbt.business_type_id = ct.id
|
|
|
+ WHERE cbt.customer_id = " . (int)$row['id']);
|
|
|
+
|
|
|
+ if ($businessTypes->num_rows > 0) {
|
|
|
+ $types = [];
|
|
|
+ while ($type = $businessTypes->fetch_assoc()) {
|
|
|
+ $types[] = $type['businessType'];
|
|
|
+ }
|
|
|
+ // 显示所有业务类型,用顿号分隔
|
|
|
+ echo implode('、', $types);
|
|
|
} else {
|
|
|
- echo "未填写";
|
|
|
+ echo '未填写';
|
|
|
}
|
|
|
?>
|
|
|
</div>
|