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

Published
2022-06-30
浏览次数 :  40

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'];
    }
    
  }
}

  • 标签1
  • 标签1
  • 标签1
Top