<?php

$db_server = "localhost";
$db_user ="root";
$db_pass ="";
$db_name ="e0";
$conn ="";

try{
$conn = mysqli_connect($db_server, $db_user, 
                        $db_pass, $db_name);
}catch(mysqli_sql_exception){
    echo "SQL Problem perhaps brother ...";
}
if($conn){
    echo "<hr><br><br>Connection : Connected to test";
}else{
    echo "<hr><br><br>Connection : No connection";
}
$Gungnir =[];
$sql = "SELECT Nama,RegNo,Saldo,Hutang,Modal FROM formalhault WHERE RegNo = 2";
$result = mysqli_query($conn,$sql);
    if(mysqli_num_rows($result)>0){
        while($row=mysqli_fetch_assoc($result)){
        $Nama = $row['Nama'];
        $RegNo = $row['RegNo'];
        $Saldo = $row['Saldo'];
        $Hutang = $row['Hutang'];
        $Modal = $row['Modal'];
        $Gungnir =[$RegNo,$Nama,$Modal,$Hutang,$Saldo];
        
    }
    }else{
    echo "Tidak ada data";
    }


echo "<br> Akun : {$Gungnir[1]}<br> Saldo : {$Gungnir[4]}";