data tidak keluar di modal bootstrap

mohon pencerahan nya gan kenapa yah apa ada yang salah? data nya tidak muncul di modal bootstrap... ini source code nya

 index.php

<?php

                    $sql =  ("SELECT cp_cid,cp_mate,cp_hues,cp_width,cp_mode,cp_name,cp_unit,cp_cury,cp_pack,cp_price,cp_date,cp_weight,cp_cprice,cp_uprice,cp_temp FROM [cust_pric] LIMIT WHERE cp_flag=0  ");
                    $result = mssql_query($sql);

        //pagination config start
        $rpp = 8; // jumlah record per halaman
        $reload = "page2.php?page = true";
        $page =isset ($_GET['page']) ? intval ($_GET ['page']) :1;
        if($page<=0) $page = 1;
        $tcount = mssql_num_rows($result);
        $tpages = isset($tcount) ? ceil($tcount/$rpp) : 1; // total pages, last page number
        $count = 0;
        $i = ($page-1)*$rpp;
        $no_urut = ($page-1)*$rpp;

        //pagination config end
        ?>
//modallll
        <div  id="myModal" class="modal fade" tabindex="-1" role="dialog">
          <div class="modal-dialog" role="document">
            <div class="modal-content">
              <div class="modal-header">
                <h4 class="modal-title">Detail information</h4>
                 <div class="modal-body">

                    <div class="fetched-data"></div>
                     <div class="modal-footer">

                       </div>
                    </div><!-- /.modal-content -->
                 </div><!-- /.modal-dialog -->
               </div><!-- /.modal -->



            <table  class="table table-datatable table-custom" id="example">
               <thead>
                  <tr>
                    <th>check</th>
                    <th>Action</th>
                    <th>No</th>
                    <th class="no-sort">Cp_Cid</th>
                    <th class="no-sort">Cp_Mate</th>
                    <th class="no-sort">Cp_Hues</th>
                    <th class="no-sort">Cp_Width</th>
                    <th class="no-sort">Cp_Name</th>
                    <th class="no-sort">Cp_Unit</th>
                    <th class="no-sort">Cp_Cury</th>
                    <th class="no-sort">Cp_Pack</th>
                    <th class="no-sort">Cp_Price</th>
                    <th class="no-sort">Cp_Date</th>
                    <th class="no-sort">Cp_Weight</th>
                    <th class="no-sort">Cp_CPrice</th>
                </tr>
            </thead>
            <tbody>
              <?php
              while(($count<$rpp) && ($i<$tcount)) {
               mssql_data_seek($result,$i);
               $data = mssql_fetch_array($result);
               ?>
               <tr>
                <td><center><input type="checkbox" value="1" <?php if($data['checkfield']=="1") echo "checked"; ?>></center></td>
                <td><button type="submit"  data-toggle="modal" data-target="#myModal" class="btn-xs btn-info" data-id="cp_cid" >Info</button></td>
                <td ><center><?php echo ++$no_urut;?></center> </td>
                <td><center><?php echo $data['cp_cid']?></center></td>
                <td><center><?php echo $data['cp_mate']?></center></td>
                <td><center><?php echo $data['cp_hues']?></center></td>
                <td><center><?php echo $data['cp_width']?></center></td>
                <td><center><?php echo $data['cp_name']?></center></td>
                <td><center><?php echo $data['cp_unit']?></center></td>
                <td><center><?php echo $data['cp_cury']?></center></td>
                <td><center><?php echo $data['cp_pack']?></center></td>
                <td><center><?php echo $data['cp_price']?></center></td>
                <td><center><?php echo $data['cp_date']?></center></td>
                <td><center><?php echo $data['cp_weight']?></center></td>
                <td><center><?php echo $data['cp_cprice']?></center></td>

            </td>

        </tr>

        <?php
        $i++;
        $count++;
    }
    ?>

</tbody>

</table>

</div>

<div><center><?php echo paginate_one($reload, $page, $tpages); ?></center></div>

</section>

</div>
</div>

//ajax

  <script type="text/javascript">
    $(document).ready(function(){
        $('#myModal').on('show.bs.modal', function (e) {
            var rowid = $(e.relatedTarget).data('cp_cid');
            //menggunakan fungsi ajax untuk pengambilan data
            $.ajax({
                type : 'post',
                url : 'detail.php',
                data :  'rowid='+ rowid,
                success : function(data){
                $('.fetched-data').html(data);//menampilkan data ke dalam modal
                }
            });
         });
    });
  </script>
<!-- content main container -->

<?php
include 'footer.php';
?>

 detail.php

<?php
$MyServer = "SERVER";
$MyUser = "hpuser";
$MyPass = "paiho@adminweb";
$MyDb	= "phmis";
$konek = mssql_connect($MyServer, $MyUser, $MyPass, $MyDb);

 if($_POST['rowid']){
    $id = $_POST['rowid'];
    $sql = mssql_query("SELECT * from [cust_pric] where cp_cid='$id'");
    $result = $konek mssql_query($sql);
        foreach ($result as $baris){  ?>
            <table class="table">
                <tr>
                    <td>no</td>
                    <td>:</td>
                    <td><?php echo $baris['cp_mate']; ?></td>
                </tr>
                <tr>
                    <td>nama barang</td>
                    <td>:</td>
                    <td><?php echo $baris['cp_hues']; ?></td>
                </tr>
                <tr>
                    <td>ukuran</td>
                    <td>:</td>
                    <td><?php echo $baris['cp_width']; ?></td>
                </tr>
            </table>
        <?php

        }
    }
?>

avatar Obbytokun
@Obbytokun

186 Kontribusi 16 Poin

Diperbarui 5 tahun yang lalu

2 Jawaban:

itu baru querynya aja tapi blom dikeluarin datanya, contoh <pre> $id = $_POST['rowid']; $sql = mssql_query("SELECT * from [cust_pric] where cp_cid='$id'"); $result = mssql_query($koneksi, $sql); // koneksinya didalam query jgn diluar while($row = mssql_fetch_assoc($result) ){ // outputnya disini } </pre> gud lak ^^

avatar bosque
@bosque

187 Kontribusi 104 Poin

Dipost 5 tahun yang lalu

sudah gan sudah saya rubah tapi masih gak kepanggil.... apa dari ajax nya yah? link js nya sengaja gak dimasukin soal nya kalo dimasukin bentrok sama js bawaan bootstrap jadi ada fungsi button yang mati.

<pre>
//ini tidak di gunakan &lt;script src="https://code.jquery.com/jquery-3.1.1.min.js"&gt;&lt;/script&gt;//// &lt;script type="text/javascript"&gt; $(document).ready(function(){ $('#myModal').on('show.bs.modal', function (e) { var rowid = $(e.relatedTarget).data('cp_cid'); //menggunakan fungsi ajax untuk pengambilan data $.ajax({ type : 'post', url : 'detail.php', data : 'rowid='+ rowid, success : function(data){ $('.fetched-data').html(data);//menampilkan data ke dalam modal } }); }); }); &lt;/script&gt; //ini tidak di gunakan &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"&gt;&lt;/script&gt;//// </pre>

avatar Obbytokun
@Obbytokun

186 Kontribusi 16 Poin

Dipost 5 tahun yang lalu

Login untuk ikut Jawaban