Back

i cant make array in DomPDF, help me..


emodt posted 2 months ago

So i have this code

<?php

//$nama   = str_replace(" ", "_", strtolower($_POST['nama']));
//$alamat = $_POST['alamat'];

require_once "../dompdf/dompdf_config.inc.php";
//$namaServer = "localhost";  via UNIX socket
    $namaServer = "localhost"; // via TCP/IP
    $namaUser = "root";
    $password = "";
    $database = "bisera";
    // membuat koneksi
    //$mysqli = new \mysqli($server, $username, null, $database);
    mysql_connect($namaServer, $namaUser, $password)or die ("error"); 
	mysql_select_db ("bisera");
	
	$query = mysql_query("SELECT *FROM data");
	
	$data = mysql_fetch_array($query); 
	$id_pembeli = $data['id_pembeli'];
	$luas_l1 = $data['luas_l1']; 
	$luas_l2 = $data['luas_l2']; 
	$kualitas = $data['kualitas']; 
	$estimasi_harga = $data['estimasi_harga']; 
	$jenis = $data['jenis']; 
	$nama_pembeli = $data['nama__pembeli']; 
	$alamat = $data['alamat']; 
	$notelp = $data['notelp']; 
	$lokasi_proyek = $data['lokasi_proyek']; 

$html =
   '<html><body>' .
    '<h1>Judul </h1>' .
    '<p><table cellspacing="6" cellpadding="6" border="1" style="border-collapse:collapse; border: 1px solid black;width:100%;" >'.
	'<tr><td>id pembeli</td><td>Luas lt1</td><td>Luas lt2</td><td>Kualitas</td><td>Estimasi Harga</td><td>Type Rumah</td>
	<td>Nama Pembeli</td><td>Alamat</td><td>Nomor Telpon</td>
	<td>Lokasi Proyek</td></tr>'.while($data = mysql_fetch_array($query)){.'<tr>'.
	'<td>'.$data['id_pembeli].'</td>'.
	'<td>'.$luas_l1.'</td>'.
	'<td>'.$luas_l2.'</td>'.
	'<td>'.$kualitas.'</td>'.
	'<td>'.$estimasi_harga.'</td>'.
	'<td>'.$jenis.'</td>'.
	'<td>'.$nama_pembeli.'</td>'.
	'<td>'.$alamat.'</td>'.
	'<td>'.$notelp.'</td>'.
	'<td>'.$lokasi_proyek.'</td>'.
	'</tr>'.}.'</table></p>' .
    '</body></html>';

$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream('laporan_'.$nama_pembeli.'.pdf');

?>

but it <b>shows Parse error: syntax error, unexpected 'while' (T_WHILE) in C:\xampp\htdocs\bisera3\Admin\print_all.php on line 37</b>

am i wrong putting that 'while' there?


Sign in to participate in this thread!



We'd like to thank these amazing companies for supporting us