解析错误:语法错误,第65行的home/search.php中出现意外的$ end [英] Parse error: syntax error, unexpected $end in home/search.php on line 65

查看:63
本文介绍了解析错误:语法错误,第65行的home/search.php中出现意外的$ end的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是怎么回事?为什么不运行?我试图浏览代码中的简单错误,但没有发现任何错误-我也浏览了论坛.没事!

What's going on here? Why won't it run? I've tried to look through the code for simple errors, and don't see any -- I've also looked through the forums. Nothing!

有没有我忘记的简单事情?

Is there something simple that I'm forgetting?

<html>
<head>
    <title>Search</title>
        <style type='text/css">

        table {
            background-color: #FCF;
            }

        th {    
        width: 150px;
        text-align: left;
        }
    </style>
</head>

<body>
<h1>Search</h1>


<form method="post" action="search.php">
<input type="hidden" name="submitted" value="true" />

<label> Search | Category:
<select name="category">
    <option value="date">Date</option>
        <option value="name">Name</option>
            <option value="account">Account</option>
                <option value="notes">Notes</option>
</select>
</label>

<label>Search Criteria: <input type="text" name="criteria" /></label>
<input type="submit" />
</form>


<?php
if  (isset($_POST['submitted'])) {

// connect to DB
include('connectdb.php');

$category = $_POST['category'];
$criteria = $_POST['criteria'];
$query = "SELECT * FROM calls WHERE $category = '$category'";
$result = mysqli_query ($dbcon, $query) or die ('Error');

echo "<table>";
echo "<tr> <th>Date</th> <th>Name</th> <th>Account</th> <th>Notes</th></tr>";

while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
echo "<tr><td>";
echo $row ['date'];
echo "<tr><td>";
echo $row ['name'];
echo "<tr><td>";
echo $row ['account'];  
echo "<tr><td>";
echo $row ['notes'];    
echo "</table>";

?>
</body></html>
}

推荐答案

对于if()语句和while()语句,您都缺少大括号.

You're missing ending curly brackets for both the if() statement and the while() statement.

在代码末尾有一个花括号,但在php标记之外.

There is a trailing curly bracket at the end of the code, but it is outside of the php tags.

这篇关于解析错误:语法错误,第65行的home/search.php中出现意外的$ end的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆