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']$露营=[“露营”]$徒步旅行=[‘徒步旅行’];