Closed. This question needs to be more focused。它当前不接受答案。
想改善这个问题吗?更新问题,使其仅通过editing this post专注于一个问题。
3年前关闭。
我在php和mysql的讨论板上工作,但是我的问题是;我如何才能让一个以上的人可以对一个讨论做出反应,就像目前只有一个人可以做出反应,因为它进入了名为数据库的字段;反应
但是我当然希望有更多的人来回答这个问题,而不是一个人。
如果有人可以告诉我如何实现这一目标,那将对市长有所帮助!
到目前为止,我尝试过的代码:
![php - 制作讨论板,如何让更多人回答-LMLPHP php - 制作讨论板,如何让更多人回答-LMLPHP]()
每当有人按下POST按钮时,它是否会替换该字段?
想改善这个问题吗?更新问题,使其仅通过editing this post专注于一个问题。
3年前关闭。
我在php和mysql的讨论板上工作,但是我的问题是;我如何才能让一个以上的人可以对一个讨论做出反应,就像目前只有一个人可以做出反应,因为它进入了名为数据库的字段;反应
但是我当然希望有更多的人来回答这个问题,而不是一个人。
如果有人可以告诉我如何实现这一目标,那将对市长有所帮助!
到目前为止,我尝试过的代码:
<?php
include('inc/conn.inc.php');
?>
<?php
if(isset($_POST['post'])){
$reactions= $_POST['msg'];
$sql = "INSERT INTO topics (reactions) VALUES reactions = :reactions";
$sql->bindParam(':reactions', $reactions);
$results = $conn->exec($sql);
}
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/styles.css">
<link rel="stylesheet" type="text/css" href="css/reset.css">
<title>Discussion Board</title>
</head>
<body>
<header>
<h1>Logo comes in here</h1>
</header>
<div id="t1">
<h1>Featured</h1>
</div>
<div id="t2">
<h1>Status</h1>
</div>
<div id="topic-items">
<?php
$id = htmlspecialchars($_GET["id"]);
/*
$sql = "SELECT creator FROM topics WHERE id = :id";
$sql->bindParam(':id', $id);
$results = $conn->query($sql);
*/
$statement = $conn->prepare("SELECT message FROM topics where id = :id");
$statement->execute(array(':id' => $id));
$row = $statement->fetch();
echo "Message: ".$row['message'];
?>
<h2>Featured items come here {discussions} deployed by php </h2>
</div>
<div id="board-status">
<h2>Board statuses come here {status} deployed by php </h2>
</div>
<div id="react-board">
<form>
Message:<br>
<textarea name="msg"></textarea><br>
<input type="submit" name="post" value="Post">
</form>
</div>
<footer>
<h1>Footer Content</h1>
</footer>
</body>
</html>
每当有人按下POST按钮时,它是否会替换该字段?
最佳答案
您首先需要以这种方式分离表:
完成后,您可以开始使用JOIN创建查询来获取数据。这样做,然后告诉我们您是否还有其他困难。
希望这可以帮助。
10-06 15:00