looking for some solutions? You are welcome.

SOLVED: How check tha value is exist or not in a table if not exist need to update?

Abi sb:
                    In my table, i insert some values like

                    id     admitad_space_id
                    ---    -------
                    1       410

My problem is ,first i need to check the table is empty.If table is empty need to work insert query otherwise need to update the 'admitad_space_id' field.only.

                <form action="" method="post">
                <div class='form-group'>
                <span>Enter Admitad Space ID</span>
                <input type='text' name="admitad_space_id" class='form-control' required>
                <button type="submit" name="submit">Submit</button>
                global $wpdb;
                 $base_table_name = $wpdb->prefix .'admitad_space_id_list';
                if (isset($_POST['submit'])) {
                 $admitad_space_id = $_POST['admitad_space_id'];
                     $wpdb->insert($base_table_name, array('admitad_space_id' => $admitad_space_id));
. Please help

Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots

No comments: