Kaynağa Gözat

fleat: contact 3

igb 1 ay önce
ebeveyn
işleme
1885dcc9c8
1 değiştirilmiş dosya ile 14 ekleme ve 31 silme
  1. 14 31
      system/customers.php

+ 14 - 31
system/customers.php

@@ -673,15 +673,11 @@ if ($act == "edit" || $act == "add") {
                 <td>
                     <?php
                     if($isEdit) {
-                        $sql = "SELECT id,tagName FROM tagtable WHERE customerId = ?";
-                        $stmt = $conn->prepare($sql);
-                        $stmt->bind_param("i", $id);
-                        $stmt->execute();
-                        $result = $stmt->get_result();
+                        $sql = "SELECT id,tagName FROM tagtable WHERE customerId = " . (int)$id;
+                        $result = $conn->query($sql);
                         while($row = $result->fetch_assoc()) {
                             echo htmlspecialchars($row['tagName']) . ',';
                         }
-                        $stmt->close();
                     }
                     ?>
                 </td>
@@ -852,6 +848,9 @@ $sql = "SELECT c.id, c.cs_code, c.cs_company, c.cs_country, c.cs_address,
         ORDER BY c.cs_updatetime DESC";
 
 $result = $conn->query($sql);
+
+$totalPages = 0;
+$pageSize = 18;
 ?>
 
 <form id="form1" method="post" action="?act=postchk&Keys=<?php echo $keys; ?>&Page=<?php echo $page; ?>" onSubmit="return false">
@@ -989,33 +988,25 @@ $result = $conn->query($sql);
                     <td align="center">
                         <?php
                         $countryId = intval($row['cs_country'] ?? 0);
-                        $sql = "SELECT countryName FROM country WHERE id = ?";
-                        $stmt = $conn->prepare($sql);
-                        $stmt->bind_param("i", $countryId);
-                        $stmt->execute();
-                        $countryResult = $stmt->get_result();
+                        $sql = "SELECT countryName FROM country WHERE id = " . $countryId;
+                        $countryResult = $conn->query($sql);
                         if ($countryRow = $countryResult->fetch_assoc()) {
                             echo htmlspecialchars($countryRow['countryName']);
                         } else {
                             echo "未选择";
                         }
-                        $stmt->close();
                         ?>
                     </td>
                     <td align="center">
                         <?php
                         $fromId = intval($row['cs_from'] ?? 0);
-                        $sql = "SELECT ch_name FROM qudao WHERE id = ?";
-                        $stmt = $conn->prepare($sql);
-                        $stmt->bind_param("i", $fromId);
-                        $stmt->execute();
-                        $qudaoResult = $stmt->get_result();
+                        $sql = "SELECT ch_name FROM qudao WHERE id = " . $fromId;
+                        $qudaoResult = $conn->query($sql);
                         if ($qudaoRow = $qudaoResult->fetch_assoc()) {
                             echo htmlspecialchars($qudaoRow['ch_name']);
                         } else {
                             echo "未选择";
                         }
-                        $stmt->close();
                         ?>
                     </td>                
                     <td align="center">
@@ -1035,17 +1026,13 @@ $result = $conn->query($sql);
                     <td align="center">
                         <?php
                         $belongId = intval($row['cs_belong'] ?? 0);
-                        $sql = "SELECT em_user FROM employee WHERE id = ?";
-                        $stmt = $conn->prepare($sql);
-                        $stmt->bind_param("i", $belongId);
-                        $stmt->execute();
-                        $empResult = $stmt->get_result();
+                        $sql = "SELECT em_user FROM employee WHERE id = " . $belongId;
+                        $empResult = $conn->query($sql);
                         if ($empRow = $empResult->fetch_assoc()) {
                             echo htmlspecialchars($empRow['em_user']);
                         } else {
                             echo "未选择";
                         }
-                        $stmt->close();
                         ?>
                     </td>                
                     <td align="center">
@@ -1067,18 +1054,14 @@ $result = $conn->query($sql);
                                     $chain_ids = array_filter(array_map('intval', $chain_array));
                                     
                                     if(!empty($chain_ids)) {
-                                        $placeholders = str_repeat('?,', count($chain_ids) - 1) . '?';
-                                        $sql = "SELECT em_user FROM employee WHERE id IN ($placeholders)";
-                                        $stmt = $conn->prepare($sql);
-                                        $stmt->bind_param(str_repeat('i', count($chain_ids)), ...$chain_ids);
-                                        $stmt->execute();
-                                        $chainResult = $stmt->get_result();
+                                        $chain_ids_str = implode(',', $chain_ids);
+                                        $sql = "SELECT em_user FROM employee WHERE id IN (" . $chain_ids_str . ")";
+                                        $chainResult = $conn->query($sql);
                                         $chain_users = [];
                                         while($chainRow = $chainResult->fetch_assoc()) {
                                             $chain_users[] = htmlspecialchars($chainRow['em_user']);
                                         }
                                         echo implode(' > ', $chain_users);
-                                        $stmt->close();
                                     }
                                 }
                                 ?>