	<?php
	$sql = 
	" SELECT deskripsi_perusahaan, website, ".
	" nama_company, logo, a.id_hall, b.id_hall, nama_stand, ".
	" nama_hall, a.idexhibitor, a.email, c.email, ket_subkat, namasubkat ".
	" FROM dt_exhibitor as a, dt_hall as b, ".
	" dt_produk_registrasi_exhibitor as c, dt_subkategori as d ".
	" WHERE a.idexhibitor = '$id' ".
	" AND a.id_hall = b.id_hall ".
	" AND a.email = c.email ".
	" AND c.idsubkat = d.idsubkat ".
	" ORDER BY ket_subkat, namasubkat ";
	//echo $sql; 

	$sql2 = 
	" SELECT deskripsi_perusahaan, website, ".
	" nama_company, logo, a.id_hall, b.id_hall, ".
	" nama_stand, nama_hall, idexhibitor ".
	" FROM dt_exhibitor as a, dt_hall as b ".
	" WHERE a.idexhibitor = '$id' ".
	" AND a.id_hall = b.id_hall ";

	$namasubkatdb = $ket_subkatdb = array();
	$namasubkat = $ket_subkat = null;
	
	if (mysql_num_rows(mysql_query($sql, $conn2)) > 0) {
		if ($hasil = mysql_query($sql, $conn2)) {
			while ($data = mysql_fetch_array($hasil)) {
				if ($data["logo"]) {
					$imageLogo = 'http://account.tradexpoindonesia.com/uploads/logo/'.$data["logo"];
					$Logo_style = 'max-height:168px;';
				} else {
					$imageLogo = $thisPage.'images/logo/logo_desktop.png';
					$Logo_style = 'display:inline-block; width:195px; padding:35px 0px 0px 0px';
				}
				
				$nama_company = $data["nama_company"];
				$deskripsi_perusahaan = (isset($data["deskripsi_perusahaan"]) ? $data["deskripsi_perusahaan"] : '');
				$website 			  = (isset($data["website"]) ? $data["website"] : '');
				$nama_hall 	    = $data["nama_hall"];
				$nama_stand     = $data["nama_stand"];
				
				//if ($namasubkat != $data["namasubkat"]) {
					$namasubkatdb[] = $data["namasubkat"];
					//$namasubkat = $data["namasubkat"];
				//}
				
				//if ($ket_subkat != $data["ket_subkat"]) {
					$ket_subkatdb[] = $data["ket_subkat"];
					//$ket_subkat = $data["ket_subkat"];
				//}
			}
		}
		//echo $nama_photo;
	} else {
		if ($hasil = mysql_query($sql2, $conn2)) {
			while ($data = mysql_fetch_array($hasil)) {
				if ($data["logo"]) {
					$imageLogo = 'http://account.tradexpoindonesia.com/uploads/logo/'.$data["logo"];
					$Logo_style = 'max-height:168px;';
				} else {
					$imageLogo = $thisPage.'images/logo/logo_desktop.png';
					$Logo_style = 'display:inline-block; width:195px; padding:35px 0px 0px 0px';
				}
				
				$nama_company 		  = (isset($data["nama_company"]) ? $data["nama_company"] : '');
				$deskripsi_perusahaan = (isset($data["deskripsi_perusahaan"]) ? $data["deskripsi_perusahaan"] : '');
				$website 			  = (isset($data["website"])    ? $data["website"] : '');
				$nama_hall 	  		  = (isset($data["nama_hall"])  ? $data["nama_hall"] : '');
				$nama_stand   		  = (isset($data["nama_stand"]) ? $data["nama_stand"] : '');
				//$namasubkat   		  = (isset($data["namasubkat"]) ? $data["namasubkat"] : '');
				//$ket_subkat   		  = (isset($data["ket_subkat"]) ? $data["ket_subkat"] : '');
			}
		}
	}
	echo '
	<section class="M00601 M0060101 teaserModule layout-centered" data-modul="M00601">
		<div class="rowInner">
			<div class="teasers">
				<div class="col l-col12 m-col12 s-col12" style="background-color:#f3f3f3">
					<div class="teasers">
						<div class="col l-col11 m-col11 s-col11">
							<div class="teasers">
								<div class="col l-col11 m-col11 s-col11">
									<div align="center" style="margin:20px 0px 0px 0px">
										<img style="'.$Logo_style.'" src="'.$imageLogo.'" border="0" />
									</div>
								</div>
							</div>
						</div>
					</div>
					<div class="teasers" style="margin-top:25px; padding-bottom:25px">
						<div class="col l-col11 m-col11 s-col11">
							<div class="teasers">
								<div class="col l-col12 m-col12 s-col12">
									<div class="teasers">
										<h5 class="h5-teaser" style="margin:0; padding:0; font-weight:normal; margin-bottom:15px">
											'.$deskripsi_perusahaan.'
										</h5>
										<div class="card card-3" style="padding:25px; background-color:#fff; width:100%">
											<p style="margin-bottom:10px; text-align:left">
												<strong>Company Name</strong>: <br>
												<strong>'.$nama_company.'</strong>
											</p>
											<p style="text-align:left">
												<strong>Hall and Stand Location</strong> <br>
												Hall Number: '.$nama_hall.' 
												&nbsp;<strong>|</strong>&nbsp; 
												Stand Number: '.$nama_stand.' 											
											</p>
											<p style="margin-bottom:0; text-align:left">
												<h4 class="h4-teaser" style="margin-bottom:15px; border-bottom:1px solid #333">
													Products
												</h4>';
												
												if ($namasubkatdb) {
													echo '
													<p style="padding:0; margin:0px 0px 10px 0px; text-align:left">
														<strong>Product\'s Category: </strong>
														<ul class="list">';	
														for($i=0; $i < count($namasubkatdb); $i++) {
															echo '
															<li>';
																echo '<strong>'.$namasubkatdb[$i].'</strong>';
																if ($ket_subkatdb[$i]) {
																	echo '<br>
																	Product\'s Description: ';
																	echo $ket_subkatdb[$i];
																}
																echo '
															</li>';
														}
														echo '
														</ul>
													</p>';
												}
												echo '
											</p>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>					
				</div>
			</div>
		</div>
	</section>
	<br><br><br>';
	/** 
	<div class="col l-col4 m-col12 s-col12">
	</div>
	<div class="col l-col8 m-col12 s-col12">
	</div>
	**/
	$nama_photo = null; $gambar = null; $deskripsi = null;
	$cek_photo = $cek_gambar = $cek_deskripsi = null;
	$sql = 
	" SELECT deskripsi_perusahaan, website, ".
	" nama_company, logo, a.id_hall, b.id_hall, nama_stand, ".
	" nama_hall, a.idexhibitor, a.email, c.email, ket_subkat, namasubkat, ".
	" e.petugas, nama_photo, gambar, deskripsi ".
	" FROM dt_exhibitor as a, dt_hall as b, dt_produk_registrasi_exhibitor as c, ".
	" dt_subkategori as d, dt_photoproduk as e ".
	" WHERE a.idexhibitor = '$id' ".
	" AND a.id_hall = b.id_hall ".
	" AND a.email = c.email ".
	" AND c.idsubkat = d.idsubkat ".
	" AND a.idexhibitor = e.idexhibitor ".
	" ORDER BY gambar ";
	if (mysql_num_rows(mysql_query($sql, $conn2)) > 0) {
		if ($hasil = mysql_query($sql, $conn2)) {
			while ($data = mysql_fetch_array($hasil)) {
				if ($cek_gambar != $data["gambar"] && $data["gambar"]) {
					$cek_gambar  = $data["gambar"];
					$nama_photo .= (isset($nama_photo) ? ';'.$data["nama_photo"] : $data["nama_photo"]);
					$gambar 	.= (isset($gambar) ? ';'.$data["gambar"] : $data["gambar"]);	
					$deskripsi 	.= (isset($deskripsi) ? ';'.$data["deskripsi"] : $data["deskripsi"]);	
				}
			}
		}
	}
	if (isset($gambar) != null) {
		$ctr = 1; $counter = 0;
		$gambar = explode (';', $gambar);	
		$deskripsi = explode (';', $deskripsi);	
		$nama_photo = explode (';', $nama_photo);	
		//echo '<p>Gambar: '.var_dump($gambar).'</p>';
		$cek_gambar = '';
		$jumlahImage = 0;
		foreach ($gambar as $key => $arr) {
			if ($arr) {
				if ($cek_gambar != $arr) {
					if (!isset(${"gambar$ctr"})) ${"gambar$ctr"} = '';
					${"gambar$ctr"} .= '
					<div class="crop" align="center">
						<a href="http://account.tradexpoindonesia.com/uploads/photo/2019/'.$arr.'" target="_blank">	
							<img title="'.$nama_photo[$key].'" alt="'.$nama_photo[$key].'" src="http://account.tradexpoindonesia.com/uploads/photo/2019/'.$arr.'" border="0" />
						</a>
					</div>
					<div style="min-width:205px">
						<div align="center"><strong>'.$nama_photo[$key].'</strong></div>
						<div align="center">'.$deskripsi[$key].'</div>
					</div>
					<div style="height:21px"></div>';
					
					if ($ctr == 3) $ctr = 0;
					$ctr++;
					$counter++;
					$jumlahImage++;
				}
				$cek_gambar = $arr;
			}
		}		
	}

	if (isset($gambar1)) {
		echo '
		<section class="M00601 M0060101 teaserModule layout-centered" data-modul="M00601">
			<div class="rowInner">
				<div class="teasers">
					<div class="col l-col12 m-col12 s-col12">
						<div class="teasers">
							<p>
								<h4 class="h4-teaser" style="margin-bottom:15px; border-bottom:1px solid #333">
									Product Images
								</h4>
							</p>
						</div>
					</div>
					<div class="col l-col12 m-col12 s-col12" style="border:1px solid #999999">';
						if (isset($gambar1)) {
							echo '
							<div class="col l-col4 m-col12 s-col12" style="padding-top:0px; padding-bottom:15px">
								'.$gambar1.'
							</div>';
						}
						if (isset($gambar2)) {
							echo '
							<div class="col l-col4 m-col12 s-col12" style="padding-top:0px; padding-bottom:15px">
								'.$gambar2.'
							</div>';
						}
						if (isset($gambar3)) {
							echo '
							<div class="col l-col4 m-col12 s-col12" style="padding-top:0px; padding-bottom:15px">
								'.$gambar3.'
							</div>';
						}
						/** 
						if (isset($gambar4)) {
							echo '
							<div class="col l-col3 m-col12 s-col12" style="padding-top:4px; padding-bottom:3px">
								'.$gambar4.'
							</div>';
						}
						**/
						echo '
					</div>
				</div>
			</div>
		</section>';	
	}
	//echo $curPage;
	$urlBack  = 
	$thisPage.$curPage.
	"?search_text=&search_text&selected_category=$selected_category";
	echo '
	<div class="col l-col12 m-col12 s-col12">
		<article class="teasers">
			<a href="'.$urlBack.'" class="hvr-sweep-to-right">
				<< Back to exhibitor list & product
			</a>
		</article>
	</div>';
	?>