php - Refresh Table When Action Create, Read, Update,Delete (CRUD) in datatables -
php - Refresh Table When Action Create, Read, Update,Delete (CRUD) in datatables -
i have problem how refresh tables when action create, read, update,delete (crud) in datatables
screnshot tables : http://prntscr.com/3voq2l
header code / head code
<style type="text/css" title="currentstyle"> @import "../stylesheets/demo_table_jui.css"; @import "../stylesheets/ui-lightness/jquery-ui-1.8.4.custom.css"; </style> <script type="text/javascript" language="javascript" src="assets/js/jquery.js"></script> <script type="text/javascript" language="javascript" src="assets/js/jquery.datatables.js"></script> <script type="text/javascript"> var rw = jquery.noconflict(); rw(function() { rw('#ff').form({ success:function(data){ rw.messager.alert('info', data, 'info'); } }); }); </script>
body code
<?php if (!function_exists("getsqlvaluestring")) { function getsqlvaluestring($thevalue, $thetype, $thedefinedvalue = "", $thenotdefinedvalue = "") { if (php_version < 6) { $thevalue = get_magic_quotes_gpc() ? stripslashes($thevalue) : $thevalue; } $thevalue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($thevalue) : mysql_escape_string($thevalue); switch ($thetype) { case "text": $thevalue = ($thevalue != "") ? "'" . $thevalue . "'" : "null"; break; case "long": case "int": $thevalue = ($thevalue != "") ? intval($thevalue) : "null"; break; case "double": $thevalue = ($thevalue != "") ? doubleval($thevalue) : "null"; break; case "date": $thevalue = ($thevalue != "") ? "'" . $thevalue . "'" : "null"; break; case "defined": $thevalue = ($thevalue != "") ? $thedefinedvalue : $thenotdefinedvalue; break; } homecoming $thevalue; } } mysql_select_db($database, $koneksi); $query_rs_datatables = "select * galeri"; $rs_datatables = mysql_query($query_rs_datatables, $koneksi) or die(mysql_error()); $row_rs_datatables = mysql_fetch_assoc($rs_datatables); $totalrows_rs_datatables = mysql_num_rows($rs_datatables); ?>
table code
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example"> <thead> <tr> <th><center>title</center></th> <th><center>date</center></th> <th><center>link video</center></th> <th><center>link photo</center></th> <th><center>image</center></th> <th><center>action</center></th> </tr> </thead> <tbody> <?php { ?> <tr> <td><center><?php echo $row_rs_datatables['judul']; ?></center></td> <td width="120px"><center><?php echo tgl($row_rs_datatables['tgl']); ?></center></td> <td align="center"> <?php if ($row_rs_datatables['video']!=null){?> <ul class="inline-popups"> <p align="center"><a href="#youtube-popup-<?php echo $row_rs_datatables['id']; ?>" data-effect="mfp-zoom-in">link</a></p> </ul> <!-- youtube popup --> <div id="youtube-popup-<?php echo $row_rs_datatables['id']; ?>" class="video-popup mfp-with-anim mfp-hide"> <div class="video-wrapper"> <iframe src="http://www.youtube.com/embed/<?php echo $row_rs_datatables['video']; ?>" allowfullscreen></iframe> </div><!-- /.video-wrapper --> </div> <?php } else { ?> <p align="center">-</p> <?php }?> </td> <td align="left"> <?php if ($row_rs_datatables['linkfoto']!=null){?> <div class="magnific-popup-wrap"> <div class="col-xs-6 col-md-3"> <p align="center"><a class="zooming" href="<?php echo $row_rs_datatables['linkfoto']; ?>" title="<?php echo $row_rs_datatables['judul']; ?>">link</a></p> </div> </div> <?php } else { ?> <p align="center">-</p> <?php }?> </td> <td align="left"> <?php if ($row_rs_datatables['foto']!=null){?> <div class="magnific-popup-wrap"> <div class="col-xs-6 col-md-3"> <p align="center"><a class="zooming" href="../images/galeri/<?php echo $row_rs_datatables['foto']; ?>" title="<?php echo $row_rs_datatables['judul']; ?>">link</a></p> </div> </div> <?php } else { ?> <p align="center">-</p> <?php }?> </td> <td> <center> <ul class="inline-popups"> <a href="#popup-edit-<?php echo $row_rs_datatables['id']; ?>" data-effect="mfp-zoom-in" style="text-decoration:none"><i class="fa fa-wrench" title="edit"></i></a> <a href="#popup-delete-<?php echo $row_rs_datatables['id']; ?>" style="text-decoration:none"><i class="fa fa-trash-o" title="delete"></i></a></ul> </center> <!-- form popup edit --> <div id="popup-edit-<?php echo $row_rs_datatables['id']; ?>" class="white-popup mfp-with-anim mfp-hide"> <form action="" method="post" > <center>edit gallery</center><br/> <div class="form-group"> <label for="exampleinputemail1">title gallery</label> <input type="text" maxlength="50" class="form-control" id="addgallery" name="ti" value="<?php echo $row_rs_datatables['judul']; ?>" placeholder="title gallery"> </div> <div class="form-group"> <label>date</label> <input type="text" name="dt" class="form-control" value="<?php echo $row_rs_datatables['tgl']; ?>" readonly> </div><!-- /.form-group --> <center><label for="exampleinputemail1">you must take 1 of following</label></center><br/> <div class="form-group"> <label for="exampleinputemail1">unique link youtube</label> <input type="text" value="<?php echo $row_rs_datatables['video']; ?>" class="form-control" id="un" name="yo" placeholder="eg: higym915gw8"> </div> <div class="form-group"> <label for="exampleinputemail1">link photo</label> <input type="text" value="<?php echo $row_rs_datatables['linkfoto']; ?>" class="form-control" id="li" name="li" placeholder="link photos"> </div> <div class="form-group"> <label for="exampleinputemail1">upload photo</label> <div class="input-group"> <span class="input-group-btn"> <span class="btn btn-default btn-file"> <i class="fa fa-camera"></i><input type="file" name="ph" > </span> </span> <input type="text" class="form-control" value="<?php echo $row_rs_datatables['foto']; ?>" readonly> </div></div> <center> <button type="submit" class="btn btn-primary">submit</button> <button type="reset" class="btn btn-danger">reset</button> </center> </form> </div> <!-- form popup delet --> <div id="popup-delete-<?php echo $row_rs_datatables['id']; ?>" class="white-popup mfp-with-anim mfp-hide"> <div class="form-group"> <center><label for="exampleinputemail1">are sure delete gallery "<?php echo $row_rs_datatables['judul']; ?>" ?</label></center> <form action="" method="post"> </div> <center><button type="submit" class="btn btn-primary">yes</button></center> <button type="button" title="close (esc)" class="mfp-close">x</button> </form> </div> </center> </td> </tr> <?php } while ($row_rs_datatables = mysql_fetch_assoc($rs_datatables)); ?> </tbody> </table> </div><!-- /.container-fluid --> <?php mysql_free_result($rs_datatables); ?>
i have not made a coding delete, create , update, seek via phpmyadmin
php jquery mysql
Comments
Post a Comment