WP 3.0 – Database access outside wp loaded files
-
I’ve been having a problem dealing with accessing the MySQL “wordpress” database from a php script that is not loaded on-screen. My vision is that the displayed page (loaded in the wordpress content wrapper with the header) will make an AJAX request to an external DB interface script (also PHP) and that script will modify the database. So far, though, I haven’t been able to get my external script to access the database. I’ve tried including the files associated with the $wpdb global class to no avail. I’ve more recently tried
include_once(WP_PATH."/wp-config.php");
and then attempted to create my own connection using mysql_connect(). This has also failed. I’m really not sure what to do in order to get the functionality I need.
Just for some background, the reason I want to do this is so that I can have a “delete” button in a list of database values, but not have to load a separate page. I’m envisioning someone clicking delete, and then confirming the operation using javascript, making the AJAX “delete” request to my DB script, and then using jQuery to remove the deleted item from the page. No page loading whatsoever.
Thanks for any help you can offer.
-RD
- The topic ‘WP 3.0 – Database access outside wp loaded files’ is closed to new replies.