簡體   English   中英

PHP錯誤解析錯誤:語法錯誤,意外的$ end

[英]PHP Error Parse error: syntax error, unexpected $end

HI收到錯誤分析錯誤:語法錯誤,/home/crafru/public_html/test/damienform.php在第124行出現意外的$ end

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="en-gb" http-equiv="Content-Language" />
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Untitled 1</title>
<style type="text/css">
.table-style1 {
    border: 1px solid #000000;
    width: 39%;
    height: 197px;
}
.table-style2 {
    border: 1px solid #000000;
    text-align: center;
    font-weight: bold;
    height: 25px;
}
.table-style3 {
    border: 1px solid #000000;
    text-align: center;
    font-weight: bold;
    width: 221px;
    height: 25px;
}
.table-style4 {
    border: 1px solid #000000;
    width: 221px;
    height: 25px;
}
.table-style5 {
    height: 25px;
    border: 1px solid #000000;
}
</style>
</head>
<body style="font-family: Arial, Helvetica, sans-serif; background-color: #EBF4FB">
<?php
    $submitrunnertime= $_POST['submitrunnertime'];
    $RunnerID= $_POST['RunnerID'];
    $EventID= $_POST['EventID'];
    $Date= $_POST['Date'];
    $Time= $_POST['Time'];
    $Position= $_POST['Position'];
    $CategoryID= $_POST['CategoryID'];
    $AgeGrade= $_POST['AgeGrade'];
    $PB= $_POST['PB'];
    $submitrunnertime= $_POST['submitrunnertime'];
    $Test = "pass";

    $host= 'localhost';
    $user= '****';  
    $password= '****';
    $database= '****';

/**
    Function: connect to a database.
    $host = hostname to connect to e.g. 'localhost'
    $id = username identity, e.g. 'ta589'
    $pwd = user password, e.g. 'twiggy9'
    $db = database to use, e.g. 'ta589'
    Returns the database connection.
**/

function connect_db($host, $user, $password, $database) {
    $connection = @mysql_connect($host, $id, $pwd)
        or die('connection problem:' . mysql_error());
    mysql_select_db($db)
        or die('db selection problem:' . mysql_error());
    return $connection;
?>

<table class="table-style1" cellpadding="0" cellspacing="0">
    <tr>
        <td class="table-style3">Feild</td>
        <td class="table-style2">Value</td>
    </tr>
    <tr>
        <td class="table-style4">Runner ID </td>
        <td class="table-style5"><?=$RunnerID?></td>
    </tr>
    <tr>
        <td class="table-style4">Event ID </td>
        <td class="table-style5"><?=$EventID?></td>
    </tr>
    <tr>
        <td class="table-style4">Date </td>
        <td class="table-style5"><?=$Date?></td>
    </tr>
    <tr>
        <td class="table-style4">Time </td>
        <td class="table-style5"><?=$Time?></td>
    </tr>
    <tr>
        <td class="table-style4">Position </td>
        <td class="table-style5"><?=$Position?></td>
    </tr>
    <tr>
        <td class="table-style4">Category ID </td>
        <td class="table-style5"><?=$CategoryID?></td>
    </tr>
    <tr>
        <td class="table-style4">Age Grade </td>
        <td class="table-style5"><?=$AgeGrade?></td>
    </tr>
    <tr>
        <td class="table-style4">PB </td>
        <td class="table-style5"><?=$PB?></td>
    </tr>
    <tr>
        <td class="table-style4">submitrunnertime </td>
        <td class="table-style5"><?=$submitrunnertime?></td>
    </tr>
    <tr>
        <td class="table-style4">Test - Remove this</td>
        <td class="table-style5"><?=$Test?></td>
    </tr>
</table>
</body>
</html>

一直在看這個,看不到任何丟失的結束位。 我想念什么?

您錯過了函數的結束符。

function connect_db($host, $user, $password, $database) {
    $connection = @mysql_connect($host, $id, $pwd)
      or die('connection problem:' . mysql_error());
    mysql_select_db($db)
      or die('db selection problem:' . mysql_error());
    return $connection;
} //<--THAT ONE

?>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM