修改错误php$chengyu = $_GETchengyu;$con = mysqli_connectlocalhost s0811030 xwDO18fsYS;if !$con dieCould not connect mysqli_error$con;mysqli_select_db$con s0811030;mysqli_set_charset$con utf8;$result
<?php
$chengyu = $_GET['chengyu'];
$con = mysqli_connect("localhost", "s0811030", "xwDO18fsYS");
if (!$con) {
die('Could not connect: ' . mysqli_error($con));
}
mysqli_select_db($con, "s0811030");
mysqli_set_charset($con, "utf8");
$result = mysqli_query($con, "SELECT * FROM chengyudaquan WHERE chengyu = '$chengyu'");
$row = mysqli_fetch_assoc($result);
mysqli_query($con, "UPDATE chengyudaquan SET view = view + 1 WHERE chengyu = '$chengyu'");
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>成语大全</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 20px;
max-width: 500px;
display: block;
margin-left: auto;
margin-right: auto;
}
<pre><code> form {
margin-bottom: 20px;
}
input[type="text"] {
padding: 5px;
width: 200px;
}
input[type="submit"] {
padding: 5px 10px;
}
.container {
padding: 20px;
border: 1px solid #ccc;
border-radius: 5px;
}
h1 {
margin-top: 0;
}
.idiom {
margin-bottom: 20px;
border: 1px solid #ccc;
border-radius: 5px;
padding: 10px;
background-color: #f7f7f7;
}
.idiom p {
margin: 0;
}
.idiom p:first-child {
font-weight: bold;
font-size: 18px;
}
.idiom p:last-child {
margin-top: 10px;
}
</style>
</head>
<body>
<div align="center">
<form method="get" action="index.php">
<input name="chengyu" type="text"/>
<input type="submit"/>
</form>
</div>
<div class="container">
<div class="idiom">
<p><?php echo $row['chengyu']; ?>(<?php echo $row['pinyin']; ?>)</p>
<p>解释:<?php echo $row['jieshi']; ?></p>
<p>来源:<?php echo $row['laiyuan']; ?></p>
<p>举例:<?php echo $row['shili']; ?></p>
</div>
</div>
</body>
</code></pre>
</html
原文地址: https://www.cveoy.top/t/topic/iN0F 著作权归作者所有。请勿转载和采集!