= '$latitude1') && (latitude <= '$latitude2') && (longitude >= '$longitude1') && (longitude <= '$longitude2') && (energy_class >= '$energy_class1') && (energy_class <= '$energy_class2') &&(depth >= '$depth1') && (depth <= '$depth2') && (date >= '$date1') && (date <= '$date2') UNION SELECT * FROM CAU WHERE (latitude >= '$latitude1') && (latitude <= '$latitude2') && (longitude >= '$longitude1') && (longitude <= '$longitude2') && (energy_class >= '$energy_class1') && (energy_class <= '$energy_class2') &&(depth >= '$depth1') && (depth <= '$depth2') && (date >= '$date1') && (date <= '$date2') UNION SELECT * FROM NTS WHERE (latitude >= '$latitude1') && (latitude <= '$latitude2') && (longitude >= '$longitude1') && (longitude <= '$longitude2') && (energy_class >= '$energy_class1') && (energy_class <= '$energy_class2') &&(depth >= '$depth1') && (depth <= '$depth2') && (date >= '$date1') && (date <= '$date2') UNION SELECT * FROM BKL WHERE (latitude >= '$latitude1') && (latitude <= '$latitude2') && (longitude >= '$longitude1') && (longitude <= '$longitude2') && (energy_class >= '$energy_class1') && (energy_class <= '$energy_class2') &&(depth >= '$depth1') && (depth <= '$depth2') && (date >= '$date1') && (date <= '$date2') UNION SELECT * FROM CRM WHERE (latitude >= '$latitude1') && (latitude <= '$latitude2') && (longitude >= '$longitude1') && (longitude <= '$longitude2') && (energy_class >= '$energy_class1') && (energy_class <= '$energy_class2') &&(depth >= '$depth1') && (depth <= '$depth2') && (date >= '$date1') && (date <= '$date2') UNION SELECT * FROM TRM WHERE (latitude >= '$latitude1') && (latitude <= '$latitude2') && (longitude >= '$longitude1') && (longitude <= '$longitude2') && (energy_class >= '$energy_class1') && (energy_class <= '$energy_class2') &&(depth >= '$depth1') && (depth <= '$depth2') && (date >= '$date1') && (date <= '$date2') ORDER BY date, hour, minute, second ASC")); echo ""; $fd = fopen("file.csv", "w"); $fd1 = fopen("file1.txt", "w"); while ($row = mysqli_fetch_array($result1)) { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; if ($row['sec_acc']=='9.99') {$row['sec_acc']='';} if ($row['coordinate_acc']=='99') {$row['coordinate_acc']='';} if ($row['depth']=='999') {$row['depth']='';} if ($row['depth_acc']=='99') {$row['depth_acc']='';} if ($row['energy_class_acc']=='9.9') {$row['energy_class_acc']='';} if ($row['magn_MLHB']=='9.9') {$row['magn_MLHB']='';} if ($row['magn_MPVA']=='9.9') {$row['magn_MPVA']='';} if ($row['magn_MSHA']=='9.9') {$row['magn_MSHA']='';} if ($row['sea_state']=='99') {$row['sea_state']='';} if ($row['number_area']=='99') {$row['number_area']='';} if ($row['amount_energy_class']=='99') {$row['amount_energy_class']='';} if ($row['amount_MLHB']=='99') {$row['amount_MLHB']='';} if ($row['amount_MPVA']=='99') {$row['amount_MPVA']='';} if ($row['amount_MSHA']=='99') {$row['amount_MSHA']='';} if ($row['minus_state']=='999') {$row['minus_state']='';} if ($row['subregion']=='99') {$row['subregion']='';} if ($row['latitude_acc']=='9.99') {$row['latitude_acc']='';} if ($row['longitude_acc']=='9.99') {$row['longitude_acc']='';} $order = $row['date'].";". $row['hour'].";". $row['minute'].";". $row['second'].";". $row['sec_acc'].";". $row['latitude'].";". $row['longitude'].";". $row['coordinate_acc'].";". $row['depth'].";". $row['depth_acc'].";". $row['energy_class'].";". $row['energy_class_acc'].";". $row['magn_MLHB'].";". $row['amount_MPVA'].";". $row['amount_MSHA'].";". $row['minus_state'].";". $row['region_code'].";". $row['numb_region'].";". $row['source_code'].";". $row['subregion'].";". $row['latitude_acc'].";". $row['longitude_acc'].";"."\r\n"; fwrite($fd1, $order); fwrite($fd, $order); echo ""; } fclose($fd1); fclose($fd); echo "
Date yyyy-mm-dd Hour Minute Second Latitude Longtitude Depth Energy class Magnitude MLHB Magnitude MPVA Magnitude MSHA Region code Abbreviated name of the region
" . $row['date'] . "" . $row['hour'] . "" . $row['minute'] . "" . $row['second'] . "" . $row['latitude'] . "" . $row['longitude'] . "" . $row['depth'] . "" . $row['energy_class'] . "" . $row['magn_MLHB'] . "" . $row['magn_MPVA'] . "" . $row['magn_MLHB'] . "" . $row['region_code'] . "" . $row['subregion'] . "
"; } else { $result1 = mysqli_query($connect, ("SELECT * FROM .$t WHERE (latitude >= '$latitude1') && (latitude <= '$latitude2') && (longitude >= '$longitude1') && (longitude <= '$longitude2') && (energy_class >= '$energy_class1') && (energy_class <= '$energy_class2') &&(depth >= '$depth1') && (depth <= '$depth2') && (date >= '$date1') && (date <= '$date2')")); echo ""; $fd = fopen("file.csv", "w"); $fd1 = fopen("file1.txt", "w"); while ($row = mysqli_fetch_array($result1)) { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; if ($row['sec_acc']=='9.99') {$row['sec_acc']='';} if ($row['coordinate_acc']=='99') {$row['coordinate_acc']='';} if ($row['depth']=='999') {$row['depth']='';} if ($row['depth_acc']=='99') {$row['depth_acc']='';} if ($row['energy_class_acc']=='9.9') {$row['energy_class_acc']='';} if ($row['magn_MLHB']=='9.9') {$row['magn_MLHB']='';} if ($row['magn_MPVA']=='9.9') {$row['magn_MPVA']='';} if ($row['magn_MSHA']=='9.9') {$row['magn_MSHA']='';} if ($row['sea_state']=='99') {$row['sea_state']='';} if ($row['number_area']=='99') {$row['number_area']='';} if ($row['amount_energy_class']=='99') {$row['amount_energy_class']='';} if ($row['amount_MLHB']=='99') {$row['amount_MLHB']='';} if ($row['amount_MPVA']=='99') {$row['amount_MPVA']='';} if ($row['amount_MSHA']=='99') {$row['amount_MSHA']='';} if ($row['minus_state']=='999') {$row['minus_state']='';} if ($row['subregion']=='99') {$row['subregion']='';} if ($row['latitude_acc']=='9.99') {$row['latitude_acc']='';} if ($row['longitude_acc']=='9.99') {$row['longitude_acc']='';} $order = $row['date'].";". $row['hour'].";". $row['minute'].";". $row['second'].";". $row['sec_acc'].";". $row['latitude'].";". $row['longitude'].";". $row['coordinate_acc'].";". $row['depth'].";". $row['depth_acc'].";". $row['energy_class'].";". $row['energy_class_acc'].";". $row['magn_MLHB'].";". $row['amount_MPVA'].";". $row['amount_MSHA'].";". $row['minus_state'].";". $row['region_code'].";". $row['numb_region'].";". $row['source_code'].";". $row['subregion'].";". $row['latitude_acc'].";". $row['longitude_acc'].";"."\r\n"; fwrite($fd1, $order); fwrite($fd, $order); echo ""; } fclose($fd1); fclose($fd); echo "
Date yyyy-mm-dd Hour Minute Second Latitude Longtitude Depth Energy class Magnitude MLHB Magnitude MPVA Magnitude MSHA Region code Abbreviated name of the region
" . $row['date'] . "" . $row['hour'] . "" . $row['minute'] . "" . $row['second'] . "" . $row['latitude'] . "" . $row['longitude'] . "" . $row['depth'] . "" . $row['energy_class'] . "" . $row['magn_MLHB'] . "" . $row['magn_MPVA'] . "" . $row['magn_MLHB'] . "" . $row['region_code'] . "" . $row['subregion'] . "
"; } ?> Save table in .CSV
Save table in .TXT

Back