Cara mengeluarkan Jumlah Item berdasarkan GMD

Halo, kali ini saya mau berbagai cara mengeluarkan jumlah item berdasarkan GMD di SLiMS.

Hal ini bertujuan untuk memberikan informasi kepada pemustaka mengenai jumlah koleksi perpustakaan berdasarkan GMD, tentu saja ini di tampilkan pada OPAC.

Berikut Screenshootnya

Screenshot at 2018-04-28 06:38:37

Rumus PHP nya :

<?php
// query librarian data

$coll_q = $dbs->query(‘
SELECT mc.gmd_name, COUNT(b.biblio_id) AS hasil FROM mst_gmd AS mc
LEFT JOIN biblio AS i ON mc.gmd_id= i.gmd_id
LEFT JOIN biblio AS b ON i.biblio_id= b.biblio_id
GROUP BY mc.gmd_name ASC’);
if ($coll_q->num_rows > 0) {
while ($colltype = $coll_q->fetch_assoc()) {
$aut = $colltype[‘gmd_name’];
$r_aut = str_replace(‘,’,’ ‘,$aut);

$value = 3;
$last_name = implode(” “, array_slice(explode(” “, $r_aut),0,$value));

echo ‘<p><a href=”index.php?title=&author=&subject=&isbn=&colltype=0&location=0&gmd=’.$last_name.’&searchtype=advance&search=search”> <i class=”ti ti-bookmark”>’.$last_name.’&nbsp&nbsp<span class=”badge”>’.$colltype[‘hasil’].'</span></a></p>’;

}
} else {
echo ‘<p>No Librarian data yet</p>’;
echo ‘</div>’;
}
?>

oke Happy Coding!

Leave a Reply

Your email address will not be published. Required fields are marked *