<style>
	.list-product {
		padding:0; margin:0;
	}
		.list-product li{
			margin-left:15px;
			padding: 0px 0px 6px 3px;
		}
</style>
<?php	
function FindDataRepeatProdukList($tableName1, $table1_Field, $searchID, $dataRecord) {
	global $conn;
	$sql7 = 
	" SELECT * FROM $tableName1 ".
	" WHERE  $table1_Field = '$searchID' ";
	//echo '<p>'.$sql7.'</p>';
	$dataRecord = "";
	if ($hasil7 = mysqli_query($conn, $sql7)) {
		if (mysqli_num_rows($hasil7) > 0) {
			$dataRecord .= '
			<ul class="list-product">';
			while ($data7 = mysqli_fetch_array($hasil7)) {
				$dataRecord .= '<li>'.$data7["valueName"].'</li>';	
			}
			$dataRecord .= '
			<ul>';
		}
	}
	return $dataRecord;
}

function FindDataRepeatProduk($tableName1, $tableName2, $table1_Field, $table1_table2, $table2_Field, $searchID, $dataRecord) {
	global $conn;
	$sql7 = 
	" SELECT * FROM $tableName1, $tableName2 ".
	" WHERE  $table1_Field = '$searchID' ".
	" AND $table1_table2 = $table2_Field limit 0,5";
	//echo $sql7;
	$dataRecord = "";
	if ($hasil7 = mysqli_query($conn, $sql7)) {
		while ($data7 = mysqli_fetch_array($hasil7)) {
			if ($dataRecord) $dataRecord .= ', ';
			$dataRecord .= $data7["valueName"];	
		}
	}
	return $dataRecord;
}

function FindDataRepeat($tableName1, $tableName2, $table1_Field, $table1_table2, $table2_Field, $searchID, $dataRecord) {
	global $conn;
	$sql7 = "SELECT * FROM $tableName1, $tableName2 WHERE  $table1_Field = '$searchID' 
			 AND $table1_table2 = $table2_Field";
	//echo '<p>'.$sql7.'</p>';
	$dataRecord = "";
	$cekData = "";
	if ($hasil7 = mysqli_query($conn, $sql7)) {
		while ($data7 = mysqli_fetch_array($hasil7)) {
			if ($cekData != $data7["valueName"]) {
				if ($cekData) {
					$dataRecord .= "<br>";	
				}
				$dataRecord .= $data7["valueName"].", Stand: ";	
				$cekData = $data7["valueName"];
			}
			$dataRecord .= $data7["standNumber"];
		}
	}
	return $dataRecord;
}

function FindDataSingle($tabelName, $tableField, $searchID, $dataRecord) {
	global $$dataRecord;
	global $conn;
	$$dataRecord = "";
	$sql7 = "SELECT $dataRecord FROM $tabelName WHERE $tableField = '$searchID' ";
	//echo $sql7;
	if ($hasil7 = mysqli_query($conn, $sql7)) {
		while ($data7 = mysqli_fetch_array($hasil7)) {
			//echo '<br>$dataRecord: '.$dataRecord; 
			//echo '<br>Data7 - dataRecord: '.$data7[$dataRecord];
			//$dataRecord = $$dataRecord;
			$$dataRecord .= $data7[$dataRecord];
		}
	}
	//echo $dataRecord;;
	return $$dataRecord;
}
function FindData($tabelID, $tabelName, &$dataTitle, &$dataRecord) {
	$sql7 = "SELECT * FROM $tabelName, form_element_sub WHERE elementSubID = elementSubParentID and valueID = '$tabelID'";
	//echo $sql7;
	global $conn;
	if ($hasil7 = mysqli_query($conn, $sql7)) {
		while ($data7 = mysqli_fetch_array($hasil7)) {
			$dataTitle = $data7["elementSubDescription"]; 
			$dataRecord = $data7["valueName"]; 
			return $dataRecord;
		}
	}
}
function InsertData($designName, $tabel1, $tabel2, $idNext) {
	global $$designName;
	global $conn;
	//echo "<br>$designName: ".$$designName;
	foreach ($$designName as &$value) {
		$value = explode('-',$value);
		$elementSubParentID = $value[0];
		$valueID = $value[1];
		if ($elementSubParentID && $valueID) {
			global ${"standNo_".$valueID};
			${"standNo_".$valueID} = $_POST["standNo_".$valueID];
			$sql7 = "INSERT INTO ".$tabel1." VALUES (null, '$idNext', '$valueID', '".${"standNo_".$valueID}."')";
			//echo "<br><br>sql: ".$sql7;  
			mysqli_query($conn, $sql7) OR die("Error:".mysqli_error($conn));
		}
	}
}

function DeleteData($tabelName,$tabelField,$exhibitorID) {
	global $conn;
	$sql7 = "DELETE FROM $tabelName WHERE $tabelField = '$exhibitorID'";
	if ($hasil7 = mysqli_query($conn, $sql7)) {
		return true;
	} else {
		return false;
	}
}

function getNumberOnly($kdNegara, $hslNumber) {
	global $conn;
	$start = 0;
	$chars = str_split($kdNegara);
	foreach ($chars as &$value) {			
		if ($value=="(") $start = 1;
		if ($start == 1) {
			$hslNumber .= $value;
		}
		if ($value==")") $start = 0;
	}
	
	return $hslNumber;
}
?>