Reputation: 4924
I need to implement a payment service provider into an existing website structure, now i have copied the website (incl. db) on my localhost for development. Now i like to hook into an existing php file and update a local table db. My question, for testing purpose is there a way i can execute mysql queries on my localhost from a live php file?
This is a function in my online php file which i like to execute a local query
function database_write_local ($code, $status)
{
//here i want to execute on my localhosted database
//general non WP query
// $qry = "UPDATE visitors_2016 SET visitorPaymentStatus = $status WHERE visitors_2016.code = $code";
//when WP query
global $wpdb;//needs to be my local mysql settings
$result = $wpdb->update('visitors_2016',array('visitorPaymentStatus'=>$status),array('code'=>$code));
}
Is it possible at all to update a local mysql table from an online php file???
Upvotes: 1
Views: 586
Reputation: 842
Short answer: no Long answer: If you have a publicly accessable IP you can start your local mysql server on that IP and connect to it from your live server. You'll need to change the relevant settings in your my.cnf file to allow remote connections and create a user that is allowed to access the database from the remote host.
Upvotes: 1