解析错误:语法错误,第115行意外的文件结束

时间:2013-07-15 03:38:11

标签: php

我已经阅读了与此相关的任何问题,答案是因为“遗漏了不少分号”。我检查了我的代码并认为没有丢失分号..但这个问题仍然发生在我身上。我的朋友,与我的代码相同,没有遇到同样的问题。

这是我的代码(第115行是</html>):

<?php
// gunakan variabel session pada halaman ini. 
// fungsi ini harus diletakkan di awal halaman.
session_start();
////// Bagian Logout. Delete variabel session.
if(empty($_SESSION['username']) AND (empty($_SESSION['password']))){
// Re-direct ke index.php
header("location:memberlogin.html");
}
?>

<html>
<head> 
<title>Home</title>

<link href="assets/css/bootstrap.css" rel="stylesheet">
<link href="assets/css/bootstrap-responsive.css" rel="stylesheet">
<!-- <link href="assets/css/docs.css" rel="stylesheet"> <!-- -->
<link href="assets/js/google-code-prettify/prettify.css" rel="stylesheet">
<link rel="shortcut icon" href="favicon.gif" type="image/x-icon"> <!--Mengganti
favicon-->

</head>
<body bgcolor="white">

<div class="navbar navbar-inverse">
<div class="navbar-inner">
<div class="container">
        <ul class="nav">
          <li class="active">
            <a href="home.php">Home</a>
          </li>
          <li class="">
            <a href="produk.php">Products</a>
          </li>
          <li class="">
            <a href="formorder.php">Order</a>
          </li>
        </ul>
    </div>
  </div>
</div>

<div class="bs-docs-example">
<ul>
    <h1><p class="text-center">Profile</p></h1>

        <dl class="dl-horizontal">
                    <dt>Nama</dt>
                    <dd><?php
                        include "connect.php";
                        $user=$_SESSION['username'];
                        $query = $con->prepare("select *
from member where username='$user'");
                        $query->execute();
                        $niplama=$query->fetch();
                        echo $niplama['nama'];
                        ?>              
                    </dd>

                    <dt>NIP</dt>
                    <dd><?php
                        echo $niplama['nip_lama'];
                        echo " / ";
                        echo $niplama['nip_baru'];
                        ?>              
                    </dd>


        </dl>
        <h4><p class="text-left">Web Service List :</p></h4>
        <table class="table">
            <thead>
                <tr>
                    <th>No</th>
                    <th>Name</th>
                    <th>Detail</th>
                    <th>Keterangan</th>
                    <th>Status</th>
                    <th></th>
                </tr>
            </thead>
<?php
include "connect.php";
$user = $_SESSION['username'];
$id_user=$con->prepare("select id from member where username='$user'");
$id_user->execute();
$ini = $id_user->fetch();
$id1 = $ini['id'];

$query2 = $con->prepare("select * from web_service where id_pemesan='$id1'");
$query2->execute();

?>
            <tbody>
            <?php 
            $nmr = 1;
            while($service = $query2->fetch()){?>
                <tr>
                    <td><?php echo $nmr; $nmr++;?></td>
                    <td><?php echo $service['kode']?></td>
                    <td><?php echo $service['nama']?></td>
                    <td><?php echo $service['deskripsi']?></td>
                    <td><?php echo $service['status']?></td>
                    <td><a href="webservice.php?kirim_id_ws=<?
php echo $service['id']?>">Lihat</a></td>
                </tr>
            <?}?>
            </tbody>
        </table>

</ul>
</div>


</body>

</html>

4 个答案:

答案 0 :(得分:1)

删除<?php起始行105之间的换行符。

答案 1 :(得分:1)

检查这段代码,我在第105行看到了一个错误,错误是你写了这样的php启动标签

<? php

那个空间是错误,我修理了它:

<?php
// gunakan variabel session pada halaman ini. 
// fungsi ini harus diletakkan di awal halaman.
session_start();
////// Bagian Logout. Delete variabel session.
if(empty($_SESSION['username']) AND (empty($_SESSION['password']))){
// Re-direct ke index.php
header("location:memberlogin.html");
}
?>

<html>
<head> 
<title>Home</title>

<link href="assets/css/bootstrap.css" rel="stylesheet">
<link href="assets/css/bootstrap-responsive.css" rel="stylesheet">
<!-- <link href="assets/css/docs.css" rel="stylesheet"> <!-- -->
<link href="assets/js/google-code-prettify/prettify.css" rel="stylesheet">
<link rel="shortcut icon" href="favicon.gif" type="image/x-icon"> <!--Mengganti
favicon-->

</head>
<body bgcolor="white">

<div class="navbar navbar-inverse">
<div class="navbar-inner">
<div class="container">
        <ul class="nav">
          <li class="active">
            <a href="home.php">Home</a>
          </li>
          <li class="">
            <a href="produk.php">Products</a>
          </li>
          <li class="">
            <a href="formorder.php">Order</a>
          </li>
        </ul>
    </div>
  </div>
</div>

<div class="bs-docs-example">
<ul>
    <h1><p class="text-center">Profile</p></h1>

        <dl class="dl-horizontal">
                    <dt>Nama</dt>
                    <dd><?php
                        include "connect.php";
                        $user=$_SESSION['username'];
                        $query = $con->prepare("select *
from member where username='$user'");
                        $query->execute();
                        $niplama=$query->fetch();
                        echo $niplama['nama'];
                        ?>              
                    </dd>

                    <dt>NIP</dt>
                    <dd><?php
                        echo $niplama['nip_lama'];
                        echo " / ";
                        echo $niplama['nip_baru'];
                        ?>              
                    </dd>


        </dl>
        <h4><p class="text-left">Web Service List :</p></h4>
        <table class="table">
            <thead>
                <tr>
                    <th>No</th>
                    <th>Name</th>
                    <th>Detail</th>
                    <th>Keterangan</th>
                    <th>Status</th>
                    <th></th>
                </tr>
            </thead>
<?php
include "connect.php";
$user = $_SESSION['username'];
$id_user=$con->prepare("select id from member where username='$user'");
$id_user->execute();
$ini = $id_user->fetch();
$id1 = $ini['id'];

$query2 = $con->prepare("select * from web_service where id_pemesan='$id1'");
$query2->execute();

?>
            <tbody>
            <?php 
            $nmr = 1;
            while($service = $query2->fetch()){?>
                <tr>
                    <td><?php echo $nmr; $nmr++;?></td>
                    <td><?php echo $service['kode']?></td>
                    <td><?php echo $service['nama']?></td>
                    <td><?php echo $service['deskripsi']?></td>
                    <td><?php echo $service['status']?></td>
                    <td><a href="webservice.php?kirim_id_ws=<?php echo $service['id']?>">Lihat</a></td>
                </tr>
            <?}?>
            </tbody>
        </table>

</ul>
</div>


</body>

</html>

答案 2 :(得分:1)

      <td><a href="webservice.php?kirim_id_ws=
      <?php echo $service['id']?>">Lihat</a></td>
      </tr>
        <?}?>

请将其更改为

    <?php } ?>

并在所有php结束标记之前留出一些空格。

答案 3 :(得分:0)

        <?}?>
        </tbody>

您在php

之后忘记了?