troubleshooting Question

PHP connect to MySQL database in Wordpress sidebar (widget)

Avatar of jazzviolin
jazzviolinFlag for China asked on
PHPMySQL ServerWordPress
7 Comments1 Solution1036 ViewsLast Modified:
I'm having trouble connecting to a database file using the "text/html" widget in Wordpress 2.8.4.  This is the widget that allows you to add text to a sidebar.  I found a plugin for including PHP in the code, but it didn't work.  (plugin: http://bit.ly/4QMCj)

The database file is at: http://www.mydomain.com/database/db.php
The WP blog is installed at  http://www.mydomain.com/blog/

The (truncated) code I'm using (which works on the HTML portion of the site) is below.

Is there a way to use absolute paths?
<?php
include '../database/db.php';
 
open_db();
 
}
 
close_db();
?>
ASKER CERTIFIED SOLUTION
pg-expert

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros