<?php
$db = mysqli_connect('127.0.0.1', 'root', '', 'siakad');
if (!$db) die("Connection failed\n");
$res = mysqli_query($db, "SELECT COUNT(*) as c FROM ref_perguruan_tinggi");
if (!$res) die("Error: " . mysqli_error($db) . "\n");
$row = mysqli_fetch_assoc($res);
echo "Count: " . $row['c'] . "\n";
if ($row['c'] > 0) {
    $res2 = mysqli_query($db, "SELECT * FROM ref_perguruan_tinggi LIMIT 5");
    while($r = mysqli_fetch_assoc($res2)) {
        print_r($r);
    }
}
