File "post-view.php"

Full path: /home/fsibplc/public_html/localhost/admin/post-view.php
File size: 4.86 B (4.86 KB bytes)
MIME-type: text/x-php
Charset: utf-8

Download   Open   Edit   Advanced Editor   Back

<?php

include('config/dbcon.php');
include('authentication.php');
//session_start();

include('include/header.php');
//include('../all/config.php'); 
?>

<div class="container-fluid px-4">
    
       <div class="row mt-4">
        <div class="col-md-12">
        <?php include('message.php'); ?>
         <div class="card">
                <div class="card-header">
                     
                    <h4>View Post<a href="post-add.php" class="btn btn-primary float-end">Add Post</a></h4>
                    
                </div>
                <div class="card-body">


                    <div class="table-responsive">
                            <table class="table bordered table-striped" id="example1">
                                    <thead>
                                        <tr>
                                            <th>ID</th>
                                            <th>Name</th>
                                            <th>Category</th>
                                            <th>Image</th>
                                            <th>Status</th>
                                            <th>View</th>
                                            <th>Edit</th>
                                            <th>Delete</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                            <?php
                           //     $post = "SELECT * FROM posts WHERE status!='2'";
                                $post = "SELECT p.*, c.name AS cname FROM posts p,categories c WHERE c.id = p.category_id ORDER BY id desc";
                                $post_run = mysqli_query($con, $post);

                                if(mysqli_num_rows($post_run)>0)
                                {

                                    foreach($post_run as $post)
                                    {
                                    ?>    
                                        <tr>
                                            <td><?= $post['id'] ?></td>
                                            <td><?= $post['name'] ?></td>
                                            <td><?= $post['cname'] ?></td> 
                                            <td>
                                            
                                                <img src="../<?= $post['image'] ?>" width="60px" height="60px" />
                                                
                                            </td>
                                            <td>
                                                <?= $post['status'] == '1' ? 'Hidden':'Visible' ?>
                                            </td>
                                            <td>
                                           
                                            <a href="<?= "https://fsiblbd.com/blog-details.php?title=".$post['slug']; ?>"  class="btn btn-primary" target="new">View  
                                            
                                            </a>
                                            </td>
                                            <td>
                                                <a href="post-edit.php?id=<?= $post['id'] ?>" class="btn btn-success">Edit</a>

                                            </td>
                                            <td>
                                                <form action="code.php" method="POST">
                                                    <button type="submit" name="post_detete_btn" value="<?= $post['id'] ?>" class="btn btn-danger" onclick='return checkDelete()'>Delete</button>
                                                </form>
                                                

                                            </td>
                                        </tr>


                                   <?php
                                    }

                                }else{
                                    ?> 
                                            <tr>
                                             <td colspan="7">No Record Found</td>
                                            </tr>

                                    <?php
                                }
                                    ?>


                                    </tbody>
                            </table>


                    </div>




                

                </div>

            </div>

        </div>

    </div>

</div>
<script type="text/javascript">
        function checkDelete(){
            return confirm('Are you sure you want to delete this record?');
        }
</script>

<?php
include('include/footer.php');

include('include/script.php');

?>