Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include "config.php";
- $data=array();
- $url="http://jadiperpusdigital.xyz/images/docs/";
- $urlpdf="http://jadiperpusdigital.xyz/repository/";
- $cek_kode=mysqli_query($konek, "select biblio_id id,title, publish_year, notes, call_number, isbn_issn, file_att, image from biblio");
- //$cek_kode=mysqli_query($konek, "desc biblio");
- $cek=mysqli_num_rows($cek_kode);
- if ($cek==0){
- echo "EROR, Coba tunggu atu perbaiki kodingan";
- }
- else
- {
- $total=0;
- while ($hasil=mysqli_fetch_array($cek_kode, MYSQLI_ASSOC))
- {
- $hasil['url_gbr']=$url.$hasil['image'];
- //author
- $sql="SELECT a.author_id,a.author_name, a.author_year, a.auth_list, a.authority_type
- FROM `biblio_author` ba join mst_author a
- on ba.author_id=a.author_id where ba.biblio_id=".$hasil['id'];
- $aSql=[$sql];
- $res=mysqli_query($konek,$sql);
- $ar=[];
- while ($row=mysqli_fetch_array($res, MYSQLI_ASSOC))
- {
- $ar[]=$row;
- }
- $hasil['author']=$ar;
- $hasil['url_gbr']=$url.$hasil['image'];
- //TOPIC
- $sql="SELECT t.auth_list, t.topic, t.topic_type,t.topic_id
- FROM `biblio_topic` bt join mst_topic t
- on bt.topic_id=t.topic_id where bt.biblio_id=".$hasil['id'];
- $aSql[]=$sql;
- $res=mysqli_query($konek,$sql);
- $ar=[];
- while ($row=mysqli_fetch_array($res, MYSQLI_ASSOC))
- {
- $ar[]=$row;
- }
- $hasil['topic']=$ar;
- //files
- $sql="SELECT t.file_id, t.file_title, t.file_name,t.mime_type
- FROM `biblio_attachment` ba join files t
- on ba.file_id=t.file_id where ba.biblio_id=".$hasil['id'];
- $aSql[]=$sql;
- $res=mysqli_query($konek,$sql);
- $ar=[];
- $pdf='';
- while ($row=mysqli_fetch_array($res, MYSQLI_ASSOC))
- {
- if(trim($row['mime_type'])=='application/pdf'){
- $pdf=$row['file_name'];
- }
- $ar[]=$row;
- }
- $hasil['files']=$ar;
- $sql="select i.item_code, i.location_id,l.loan_date,l.due_date
- from item i left join loan l on i.item_code=l.item_code where
- biblio_id='{$hasil['id']}'";
- $aSql[]=$sql;
- $res=mysqli_query($konek,$sql);
- $ar=[];$nStock=0;
- while ($row=mysqli_fetch_array($res, MYSQLI_ASSOC))
- {
- if($row['due_date']>date("Y-m-d")){
- //stock tidak ada
- }else{
- $nStock++;
- }
- $ar[]=$row;
- }
- $hasil['stocks']=$ar;
- $hasil['stock_avaiable']=$nStock;
- //$hasil['sql']=$aSql;
- if($hasil['file_name']!=""){
- $hasil['url_pdf']= $urlpdf.$hasil['file_name'];
- }elseif(trim($pdf)!=''){
- $hasil['url_pdf']= $urlpdf.$pdf;
- }else{
- $hasil['url_pdf']=false;
- }
- //$hasil['url_pdf_1']=$pdf;
- $data[]=$hasil;
- $total++;
- }
- $result=[
- 'data'=>$data,
- 'total'=>$total
- ];
- $final=json_encode($result);
- //echo '<pre>xxx';print_r($result);die();
- echo json_encode ($result);
- //echo substr($title,10);
- //echo json_encode ($data);
- //echo substr($title,10);
- }
Add Comment
Please, Sign In to add comment