2013-07-15 60 views
-3

我已經閱讀了任何與此相關的問題,並且答案表示這是因爲「缺少了很多分號」。我檢查了我的代碼,並認爲沒有缺少分號..但這個問題仍然發生在我身上。我的朋友,與我的代碼相同,不會遇到同樣的問題。解析錯誤:語法錯誤,第115行上的文件意外結束

這裏是我的代碼(行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> 
+0

「缺少了很多分號」---你沒有足夠的注意力(或者你試圖欺騙說謊)。我打開了隨機問題,答案中的原因是關於另一個錯過的元素。 – zerkms

回答

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

請更改爲

<?php } ?> 

和所有的PHP結束標記之前留有一定的空間。

+0

這是工作。好的謝謝:)) – machmum

+0

好吧,歡迎如果它的工作不要忘記標記爲答案.. – Bharu

1

其間<?php刪除換行符起跑線105

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> 
0
 <?}?> 
     </tbody> 

您忘記了php?

相關問題