循环数据表所有数据并陈列数据的写法

Published
June 30, 2022
浏览次数 :  4

function get_option($option) {
  global $conn;
  $sql = $conn->query("SELECT * FROM settings");
  $results = $sql->fetch_all(MYSQLI_ASSOC);
  foreach($results as $result) {
    if ($option == $result['option_name']) {
      echo $result['option_value'];
    }
    
  }
}

Top