Hello,
I am simply trying to insert a row into my custom table I put in the WP DB, however when I try it, it gives me the error in the topic title. I have set $wpdb as global so I'm not sure why it's still not working. I am a newbie still at PHP.
Thanks a lot.
<?php
global $table;
global $footer_slogan;
global $wpdb;
$table = $wpdb->prefix . 'customtable';
$footer_slogan = $_POST['footer_slogan'];
function test_insert_data() {
global $wpdb;
global $table;
global $footer_slogan;
$data = array('element_name'=>'Footer Slogan',
'element_show'=>1,
'element_content'=>$footer_slogan);
$wpdb->insert( $table, $data );
}
test_insert_data();
?>