Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP-Echo数组错误_Php_Sql_Arrays_Row_Echo - Fatal编程技术网

PHP-Echo数组错误

PHP-Echo数组错误,php,sql,arrays,row,echo,Php,Sql,Arrays,Row,Echo,如果忘记写入$row,请使用此代码- <?php if (isset($_GET['id']) && filter_var($_GET['id'], FILTER_VALIDATE_INT)) { $id=$_GET['id']; }else{ header('HTTP/1.0 404 Not Found'); exit("<h1>Not Found</h1>\n<p>The submitted data is not


如果忘记写入$row,请使用此代码-

<?php

if (isset($_GET['id']) && filter_var($_GET['id'], FILTER_VALIDATE_INT)) {
    $id=$_GET['id'];
}else{
  header('HTTP/1.0 404 Not Found');
  exit("<h1>Not Found</h1>\n<p>The submitted data is not valid.</p>");
}



$query = "SELECT * FROM all_parks WHERE id = $id";


$result = mysqli_query($conn, $query) or die ("Error querying database.");


$row = mysqli_fetch_array($result);
  $state = $row['state'];
  $type = $row['type'];
  $name = $row['name'];
  $short_intro = $row['short_intro'];
  $long_description = $row['long_description'];
  $parkimage = $row['image_url'];
  $allowed = $row['allowed'];
  $not_allowed = $row['not_allowed'];
  $warnings = $row['warnings'];
  $more_details = $row['more_details'];
  $neighboring_parks = $row['neighboring_parks'];
  $website = $row['website'];
  $camping = $row['camping'];
  $hiking = $row['hiking'];
  $volunteer = $row['volunteer'];
  $map = $row['google_map_location'];
  $telephone = $row['telephone'];
  $email = $row['email'];

?>


它会起作用。

使用
而($row=mysqli_fetch_array($result))
则会起作用。

请添加一些解释将$row添加到此数组变量$website=['website']$露营=[“露营”]$徒步旅行=[‘徒步旅行’];