$wpdb->update won't write to database
-
Hi,
I’m mucking around writing my first plugin for WP, but I’m stuck with the $wpdb object.
The plugin creates a new table in the database, with the code I found in the Codex.
Anyway, heres the code
<?php global $wpdb; if($_POST['oscimp_hidden'] == 'Y') { $blogcat = $_POST['cat']; $imageurl = $_POST['image_url']; $wpdb->update( 'wp_blogcathead', array( 'blogcat' => $blogcat, 'imageurl' => $imageurl ), array('%s', '%s')); ?> <div class="updated"><p><strong><?php _e('Options saved.' ); ?></strong></p></div> <?php } else { //Normal page display } ?> <div class="wrap"> <?php echo "<h2>" . __( 'Blog Category Header Images', 'oscimp_trdom' ) . "</h2>"; ?> <form name="oscimp_form" method="post" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>"> <input type="hidden" name="oscimp_hidden" value="Y"> <p>Select category: <?php wp_dropdown_categories(); ?></p> <p>Image URL: <input type="text" name="image_url" size="20" value=""/></p> <p class="submit"> <input type="submit" name="Submit" value="Click it!" /> </p> </form> <table>I don’t get an error, but it’s not writing the two variable values.
Anyone know what I’ve missed?
Thanks.
PS I know the code is messy 🙂
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘$wpdb->update won't write to database’ is closed to new replies.