I am carrying a variable via $_GET to a page which processes the action, the variable carries over correctly but the database won't update and throws an error.
Here is my link with a varible;
echo "<td><a href='".plugins_url()."/myremovalsquote/inc/disable.php?id=".$active_partner->partner_id."' class='button-primary'>Disable</a></td>";
I then use the variable passed in my /disable.php
$id = $_GET['id'];
echo $id;
global $wpdb;
if ($commit = $wpdb->query("UPDATE partners SET active='no' WHERE partner_id='"'$id'"'")) {
echo 'Success';
} else {
echo 'Failed';
}
The echo outputs the correct string, but then I get this error message.
77
Fatal error: Call to a member function query() on a non-object in /home/myremovalsquote/public_html/wp-content/plugins/myremovalsquote/inc/disable.php on line 9
$wpdbis only available if you have loaded WordPress, butdisable.phpis just a PHP file that is not loading WordPress.