1

message error like below

Parse error: syntax error, unexpected $end

we know this error always caused by missing tag of php like ';','}',..I have checked this syntax for two hours but i didn't find what the mistake.

<?php
include "config/koneksi.php"; 

$kolom = $_POST['kolom']; 
$kolom1 = $_POST['kolom1']; 
$data = mssql_query("SELECT * FROM tblTrnProduct WHERE (Posisi LIKE '$kolom%' or Posisi LIKE '$kolom1%') Order BY Posisi,ProductName ASC"); 
$n = mssql_num_rows($data);
$no=1;
if($n == "0"){echo "error"; }
else{
$data1 = mssql_query("SELECT * FROM tblTrnProduct where (Posisi LIKE '$kolom%' or Posisi LIKE '$kolom1%') AND ProductName = 'TCA CREAM 65 ML FC 24% A Z A M' ORDER BY Line,PalletNumber ASC");
$n1 = mssql_num_rows($data1);
$j = mssql_fetch_array(mssql_query("SELECT SUM (Quantity) as total FROM tblTrnProduct where (Posisi LIKE '$kolom%' or Posisi LIKE '$kolom1%') AND ProductName = 'TCA CREAM 65 ML FC 24% A Z A M'"));
$jumlah = $j['total'];
if($n1 == "0"){echo" <br><strong>Produk TCA AZZAM tidak ditemukan</strong></br>"; }
else{?>
<div id="print-area-2" class="print-area">
<div style="text-align:right;"><a class="no-print" href="javascript:printDiv('print-area-2');"><font color='#0000CC'><strong> Print </strong></font></a></div>
<br><strong>Produk TCA AZZAM</strong></br><br>
<table border='1' bgcolor='#CCFF66'>
  <thead>   
  <tr>
    <th>Nomor Rak</th>
    <th>Nama Produk</th>
    <th>Kode Produksi</th>
    <th>Line/FM</th>
    <th>Nomor Palet</th>
    <th>Nomor Seri Produk</th>
    <th>Quantity</th>
    </tr>
</thead>
<?php while ($d=mssql_fetch_array($data1)){
$Posisi = $d[Posisi];
$ProductName = $d[ProductName];
$ProductionDate = $d[ProductionDate];
$Line = $d[Line];
$PalletNumber = $d[PalletNumber];
$SeriNumber = $d[SeriNumber];
$Quantity = $d[Quantity];
echo"
<tbody>
    <tr>
    <td><div align='center'>$Posisi</div></td>
    <td><div align='left'>$ProductName</div></td>
    <td><div align='center'>$ProductionDate</div></td>
    <td><div align='center'>$Line</div></td>
    <td><div align='center'>$PalletNumber</div></td>
    <td><div align='center'>$SeriNumber</div></td>
    <td><div align='center'>$Quantity</div></td>
    </tr>";
    $no++;}
echo"<tr>
    <td colspan='6'><div align='center'><strong>Jumlah</strong></div></td>
    <td colspan='2'><div align='center'><strong>$jumlah Carton</strong></div></td>
    </tr>
</tbody>";} ?>
</table></br><br>
<?php
$data2 = mssql_query("SELECT * FROM tblTrnProduct where (Posisi LIKE '$kolom%' or Posisi LIKE '$kolom1%') AND ProductName = 'TCA CREAM 65 ML FC 24% SUN KARA' ORDER BY Line,PalletNumber ASC");
$n2 = mssql_num_rows($data2);
$j = mssql_fetch_array(mssql_query("SELECT SUM (Quantity) as total FROM tblTrnProduct WHERE (Posisi LIKE '$kolom%' or Posisi LIKE '$kolom1%') AND ProductName = 'TCA CREAM 65 ML FC 24% SUN KARA'"));
$jumlah = $j['total'];
if($n2 == "0"){echo"<br><strong>Produk TCA SUN KARA tidak ditemukan</strong></br>"; }
else{ ?>
<strong>Produk TCA SUN KARA</strong>
<table border='1' bgcolor='#CCFF66'>
  <thead>   
  <tr>
    <th>Nomor Rak</th>
    <th>Nama Produk</th>
    <th>Kode Produksi</th>
    <th>Line/FM</th>
    <th>Nomor Palet</th>
    <th>Nomor Seri Produk</th>
    <th>Quantity</th>
    </tr>
     </thead>
<?php while ($d=mssql_fetch_array($data2)){
$Posisi = $d[Posisi];
$ProductName = $d[ProductName];
$ProductionDate = $d[ProductionDate];
$Line = $d[Line];
$PalletNumber = $d[PalletNumber];
$SeriNumber = $d[SeriNumber];
$Quantity = $d[Quantity];
echo"
<tbody>
    <tr>
    <td><div align='center'>$Posisi</div></td>
    <td><div align='left'>$ProductName</div></td>
    <td><div align='center'>$ProductionDate</div></td>
    <td><div align='center'>$Line</div></td>
    <td><div align='center'>$PalletNumber</div></td>
    <td><div align='center'>$SeriNumber</div></td>
    <td><div align='center'>$Quantity</div></td>
    </tr>";
    $no++; }    
echo"
    <tr><td colspan='6'><div align='center'><strong>Jumlah</strong></div></td>
    <td colspan='2'><div align='center'><strong>$jumlah Carton</strong></div></td>
    </tr>
</tbody>"; } ?>
</table></br><br>
<?php $data3 = mssql_query("SELECT * FROM tblTrnProduct where (Posisi LIKE '$kolom%' or Posisi LIKE '$kolom1%') AND ProductKategori = 'BULK PACK' ORDER BY Line,PalletNumber ASC");
$n3 = mssql_num_rows($data3);
$j = mssql_fetch_array(mssql_query("SELECT SUM (Quantity) as total FROM tblTrnProduct where (Posisi LIKE '$kolom%' or Posisi LIKE '$kolom1%') AND ProductKategori = 'BULK PACK'"));
$jumlah = $j['total'];
if($n3 == "0"){echo"<br><strong> Produk BULK PACK tidak ditemukan</strong></br>";}
else{ ?>
<strong>Produk BULK PACK</strong>
<table border='1' bgcolor='#CCFF66'>
  <thead>   
  <tr>
    <th>Nomor Rak</th>
    <th>Nama Produk</th>
    <th>Kode Produksi</th>
    <th>Line/FM</th>
    <th>Nomor Palet</th>
    <th>Nomor Seri Produk</th>
    <th>Quantity</th>
    </tr>
</thead>
<?php while ($d=mssql_fetch_array($data3)){
$Posisi = $d[Posisi];
$ProductName = $d[ProductName];
$ProductionDate = $d[ProductionDate];
$Line = $d[Line];
$PalletNumber = $d[PalletNumber];
$SeriNumber = $d[SeriNumber];
$Quantity = $d[Quantity];
echo"
<tbody>
    <tr>
    <td><div align='center'>$Posisi</div></td>
    <td><div align='left'>$ProductName</div></td>
    <td><div align='center'>$ProductionDate</div></td>
    <td><div align='center'>$Line</div></td>
    <td><div align='center'>$PalletNumber</div></td>
    <td><div align='center'>$SeriNumber</div></td>
    <td><div align='center'>$Quantity</div></td>
    </tr>";
    $no++ ; }
echo"<tr>
    <td colspan='6'><div align='center'><strong>Jumlah</strong></div></td>
    <td colspan='2'><div align='center'><strong>$jumlah Carton</strong></div></td>
    </tr>
</tbody>"; } ?>
</table>
</div></br>
<br><input type='button' value='Back' id='back' onclick='window.location.reload()'></input></br>
<?php} ?>

help me to find what the mistake. Thanks...

4
  • This question appears to be off-topic because it is about finding a syntax error Commented Oct 4, 2013 at 9:06
  • 1
    We have seen worse questions then this. Sometimes you need a new set of eyes to find a mistake. Commented Oct 4, 2013 at 9:11
  • 1
    i copy pasted your code in NetBeans it gave me the same error but its fine after i formatted the code Commented Oct 4, 2013 at 9:36
  • i have taken screen shots also of that Commented Oct 4, 2013 at 9:43

2 Answers 2

3

Just fix your last line like this:

<?php
}
?>
Sign up to request clarification or add additional context in comments.

4 Comments

That's the only problem I can see as well.
Tq for the answer, but i have tried that before. Same message error for the result
Then I doubt that the code you provided is the only code on your page. The parse error could originate in the included file.
@Sébastien Tq... for your opinion
0

I think that our last line should be ?> based on PHP standard:

<?php  ?>

Hope this help!

Regards!

2 Comments

What would that do? And would that fix the problem described?
Yes and no, you just copied the first guy that answered. the last line needs to close the first else. So <?php } ?> is correct. Having <?php ?> does nothing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.