-3

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

这是我的代码(第 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

4 回答 4

1

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

于 2013-07-15T03:41:46.577 回答
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>
于 2013-07-15T03:42:30.940 回答
1
      <td><a href="webservice.php?kirim_id_ws=
      <?php echo $service['id']?>">Lihat</a></td>
      </tr>
        <?}?>

请将其更改为

    <?php } ?>

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

于 2013-07-15T03:46:48.763 回答
0
        <?}?>
        </tbody>

你忘了php后面?

于 2013-07-15T03:45:27.677 回答