I created a plugin which creates a database-table (wp_mediopay) and a widget in the admin dashboard. In this widget is a form, which should update an entry in the database table after being submitted.
I simply made it POST to saveentry.php. Then I created saveentry.php in the wp_admin folder:
$newaddress = $_POST["address"]; $table_name = "wp_mediopay"; global $wpdb; $newaddress = array( 'address' => '$newaddress' ); $data_where = array( 'id' => 1); $wpdb->update($table_name,$newaddress,$data_where);
but nothing happens. echo $newaddress works.
Weirdly, when I use this:
$myrows = $wpdb->get_results( "SELECT address FROM wp_mediopay WHERE id = 1" ) var_dump($myrows);
I get an error 500. When I do this in my plugin file it works fine.