<?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=&quot;text&quot;] {
			padding: 5px;
			width: 200px;
		}
		
		input[type=&quot;submit&quot;] {
			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;
		}
	&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
	&lt;div align=&quot;center&quot;&gt;
		&lt;form method=&quot;get&quot; action=&quot;index.php&quot;&gt;
			&lt;input name=&quot;chengyu&quot; type=&quot;text&quot;/&gt;
			&lt;input type=&quot;submit&quot;/&gt;
		&lt;/form&gt;
	&lt;/div&gt;
	&lt;div class=&quot;container&quot;&gt;
		&lt;div class=&quot;idiom&quot;&gt;
			&lt;p&gt;&lt;?php echo $row['chengyu']; ?&gt;(&lt;?php echo $row['pinyin']; ?&gt;)&lt;/p&gt;
			&lt;p&gt;解释:&lt;?php echo $row['jieshi']; ?&gt;&lt;/p&gt;
			&lt;p&gt;来源:&lt;?php echo $row['laiyuan']; ?&gt;&lt;/p&gt;
			&lt;p&gt;举例:&lt;?php echo $row['shili']; ?&gt;&lt;/p&gt;
		&lt;/div&gt;
	&lt;/div&gt;
&lt;/body&gt;
</code></pre>
</html
修改错误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

原文地址: https://www.cveoy.top/t/topic/iN0F 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录