为什么这个简单的代码不起作用?不能结束php代码?>。使用Wampserver 2.5。没有任何记录在db_words中。 已经在互联网上搜索了几天但没有答案。 这很简单,强制加入两个词在words_db这个简单的代码为什么不起作用?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ORDLISTA</title>
</head>
<body>
<h1>Lägg till ord</h1>
<form action="addword.php" method="post">
Ord: <input type="text" name="ord"><br></br>
Förklaring: <input type="text" name="forklaring"><br></br>
<input type="submit">
</form>
</body>
</html>
MY PHP CODE addword.php
<?php
$con=mysqli_connect("localhost","root","","words_db");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// Perform queries
mysqli_query($connect,"INSERT INTO ordlista (ord, forklaring)
VALUES ('$_POST[ord]', '$_POST[forklaring]');
mysqli_close($con);
?>
我得到的php文件线11和12个公告。是的,我是一个新手。 – bengan
是的,我知道通知即将出现。当我说点什么时,人们不会听。 –