<?php 

$host="localhost";
$username="sdibanja_cashless";
$password="h02vWBY8rpCm";
$koneksi=@mysqli_connect($host,$username,$password,"sdibanja_cashless_dbregistrasi");


$query = "SELECT * FROM tbregister_andro where kategori='tabungan' ";
$sql = mysqli_query($koneksi,$query);

while($data = mysqli_fetch_array($sql)){
$namesch=$data['nama_sekolah'];		
$dbcon=$data['dbcon'];
$usercon=$data['usercon'];
$passcon=$data['passcon'];


$host="localhost";

$koneksi2=@mysqli_connect($host, $usercon, $passcon, $dbcon);

$res=mysqli_query($koneksi2,"SELECT * FROM `tb_anggota`");

if ($res) {
  echo "Returned rows are: " . mysqli_num_rows($res)."<br>";

} else {
  //  $dbcon2 = substr($dbcon, 0, -1);
    echo "gagal :".$dbcon."<br>";
  //  $db2=$dbcon.'2';
  
//    mysqli_query($koneksi,"UPDATE `tbregister_andro` SET `dbcon` = '".$dbcon2."' WHERE dbcon='".$dbcon."' ");
}


}


?>