I'm writing a plugin for wordpress. I just finished my admin page. It has a submit button. The action attribute of form element is sending to "database.php" file.
Here's the code of database.php:
<?php
global $wpdb;
$table_name = $wpdb->prefix . "ArmPoll_Questions";
if($_SERVER["REQUEST_METHOD"]=="POST")
{
$wpdb->insert($table_name, array('id'=>'','Question'=>'How r u?'));
}
?>
But it leads to an error which says
Call to a member function insert() on null