default column value during insert
-
Hi, I have a table with a field that contains post id (of a custom post type). My question is when I insert a new record, I would like to read-only this field and give a default value.
Currently, I am pasting the post id via ?post_id=999 on the URL. To insert the shortcode, I use:-
<?php
if (isset($_GET[‘post_id’])) {
$thepost_id = $_GET[‘post_id’];
$thispost = get_post( $thepost_id, OBJECT );
echo ‘<p>Editing ‘ . $thispost->post_title . ‘</p>’;
echo ‘[wpdatatable id=3 var1=’ . $thepost_id . ‘]’;
echo ‘<div id=”thispostid” style=”display: none;”>’ . $thepost_id . ‘</div>’;
} else {
echo ‘<p>No Class Data</p>’;
}echo <<<EOT
<script>document.write(‘Click me to go Back‘);</script>
EOT;And I use “where classname= %VAL1%” in SQL. Any ideas?
The topic ‘default column value during insert’ is closed to new replies.