database - Delete query not working in plugin

admin2025-06-04  3

        <?php if(isset($_POST['deleteValues'])){

                    global $wpdb;
                    $table = $wpdb->prefix . 'addkeywords';
                    $where = array( 'id' => $id);
                    $where_format = array( '%d');
                    $deleteTable= $wpdb->delete( $table, $where, $where_format ); 

                    if($deleteTable){
                        echo '<script>alert("Done")</script>';  
                        }else{
                        echo '<script>alert("Not Done")</script>';  
                    }    
                }
                ?>

    <td><form method="post" action=""> 

                <?php if(!empty($_POST['id'])){ ?>


                <?php } else { ?>

                    <button class="btn btn-danger" id="editValues" name="deleteValues">Delete</button>

                <?php } ?>

            </form></td>
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749023691a315708.html

最新回复(0)