对你们来说可能是一个简单的错误,我是php新手

对你们来说可能是一个简单的错误,我是php新手,php,error-handling,Php,Error Handling,这是我在这里的第一篇帖子,当人们告诉我你们很乐意帮助有问题的人时,我感到非常受欢迎。 我正在为学校的一个节日制作一个网站,今天我不知怎的出错了: mysqli_query()至少需要两个参数,其中一个参数在第135行的C:\xampp\htdocs\projectsite\News.php中给出 <?php session_start(); if (isset($_SESSION['test'])){ }else{ $_SESSION["test"]=0; }?> <

这是我在这里的第一篇帖子,当人们告诉我你们很乐意帮助有问题的人时,我感到非常受欢迎。 我正在为学校的一个节日制作一个网站,今天我不知怎的出错了:

mysqli_query()至少需要两个参数,其中一个参数在第135行的C:\xampp\htdocs\projectsite\News.php中给出

<?php
session_start();
if (isset($_SESSION['test'])){

}else{
    $_SESSION["test"]=0;
}?>
<!DOCTYPE html>
<html>
<head>
<link rel="icon" type="" href="http://example.com/myicon.png">
    <link rel="stylesheet" type="text/css" href="css.css">
</head>
<title>News</title>
</style>
<body bgcolor="#E6E6FA"> 
<a href="http://localhost/projectsite/index.php" ><img src="images/nl.png"/></a>
<a href="http://localhost/projectsite/homeenglish.php" ><img src="images/uk.png"/></a>
<body background="images/achtergrondje2.jpg" style=>
<style>
ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid #ffffff;
    background-color: #494b4a;
}

li {
    float: left;
}

li a {
    display: block;
    color: #dadada;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
}

li a {
    display: block;
    <img src="images/bannertje2.jpg"
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
}

li a:hover:not(.active) {
    background-color: #dadada;
}

li a.active {
    color: white;
    background-color: #e83d3d;
}
</style>

</head>
</head>
<body><font color="white"
</body>
<ul>
  <li><a href="http://localhost/projectsite/index.php">Home</a></li>
  <li><a href="http://localhost/projectsite/lineup.php">Line-up</a></li>
  <li><a href="http://localhost/projectsite/inschrijven.php">Inschrijven</a></li>  
  <li><a class="active" href="http://localhost/projectsite/news.php">Nieuws</a></li>
  <li style="float:right"><a class="active" href="http://localhost/projectsite/contact.php">Over ons</a></li>
  <li style="float:right"><a class="active" href="http://localhost/projectsite/logout.php">Logout</a></li>
  <li style="float:right"><a class="active" href="http://localhost/projectsite/Loginmain.php">Login</a></li>

    <br>
</ul>
  <?php if ($_SESSION["test"] == 1)
  {
?><li style="float:right" ><a class="active" href="html.php">uitloggen</a></li><?php
?><li style="float:right" ><a href=''><?php echo "Welkom Back ". $_SESSION["username"] . "( ͡° ͜ʖ ͡°)"?></a></li><?php
  }else{
  }  
  ?>
</ul>
<div class="flex-container">
<form method="POST">
    <table>
    <tr><td><h2>Nieuwsitem Toevoegen</h2></td></tr>
        <tr>
            <th>Title:</th>
            <td><input type="text" name="txtTitle" /></td>
        </tr>
        <tr>
            <th>Plaats:</th>
            <td><input type="text" name="txtPlaats" /></td>
        </tr>
        <tr>
            <th>Description:</th>
            <td><input type="text" name="txtDescription"  /></td>
        </tr>
        <tr>
            <th></th>
            <td><input type="submit" name="btnnews" value="Invoeren" /></td>
        </tr>
        <tr>
            <th></th>
            <td><input type="submit" name="btnnwesplaatsen1" value="plaatsen" /></td>
        </tr>
    </table>
</form>


<?php
    require('connect.php');
    // If the values are posted, insert them into the database.
    if (isset($_POST['btnnews']))
    {
        $title = $_POST['txtTitle'];
    $Description = $_POST['txtDescription'];
        $plaatsID = $_POST['txtPlaats'];

        $query = "INSERT INTO `nieuwsitems` (txtPlaats, txtTitle, txtDescription) VALUES ($plaatsID, '$title', '$Description')";
        $result = mysqli_query($connection);
        if($result)
        {
            $smsg = "Succes";
        }else{
            $fmsg ="";
        }
    }
include("connect.php");
if(isset($_POST['btnnwesplaatsen1']))
{
$query = "SELECT * FROM nieuwsitems WHERE PlaatsID= 1";
$result = mysqli_query($db, $query);

$row = mysqli_fetch_array($result);

$titel = $row['Title'];
$item = $row['Description'];

echo "$titel".'<br>';
echo "$item".'<br><hr>';
}
?>
</body>

</html>

新闻
保险商实验室{
列表样式类型:无;
保证金:0;
填充:0;
溢出:隐藏;
边框:1px实心#ffffff;
背景色:#494b4a;
}
李{
浮动:左;
}
李阿{
显示:块;
颜色:#达达达;
文本对齐:居中;
填充:14px 16px;
文字装饰:无;
}
李阿{
显示:块;
  • 尼乌维斯特姆·托沃根 标题: 普拉茨: 说明:
    在代码中替换该行

    $result = mysqli_query($connection,$query);
    

    您好,将此添加到第135行:$db作为第一个参数。anser正确,然后单击右键标记使其正确
    $result = mysqli_query($connection,$query);