query("SELECT * FROM allstores_backup WHERE barcode = '$barcode' ORDER BY price DESC"); $num_rows = mysqli_num_rows($result); $data = ""; if($num_rows>0) { while($row=mysqli_fetch_array($result)) { $price = $row[2]; $store = trim($row[6]); $storecode = $row[7]; if($storecode>0) { echo "Storecode=".$storecode." "; $result1 = $mysqli->query("SELECT * FROM ahdisorn_store WHERE storecode = '$storecode'"); $row=mysqli_fetch_array($result1); $store = trim($row[6]); } $data = number_format($price,2); //echo $data."
"; //$data = (string) $price; $dlen = strlen($store); $space = 13-$dlen; $alldata = " ".$store.str_repeat(" ",$space).$data." บาท\n".$alldata; } echo $alldata."."; } ?>