On Sun, 2010-05-16 at 13:14 -0400, Jason Pruim wrote: > Hi Everyone! > > So I'm sitting here trying to get my RSS feed to work off of my main > database login script so that I can centralize the management of the > whole blasted thing, you know... stuff like only having the password > in one place to log into the DB :) > > I can connect just fine if I include all the connection stuff locally > in my file, but when I try and include it so I don't have to reinvent > the wheel it says it can't connect.... Host, Username, & Password have > all been checked and doubled checked. And actually the database > connection script works just fine since I'm using it to pull the > content from my main page and that's working just fine... > > > Here's the code I'm using locally on the page: > > <?PHP > $server = "localhost"; > $username = "realusername"; > $password = "realpass"; > $database = "realdatabase"; > > > $linkID = mysql_connect($server, $username, $password) or die("Could > not connect to host." . mysql_error()); > mysql_select_db($database, $linkID) or die("Could not find > database." . mysql_error($linkID)); > ?> > > That code works... > > When I change it to: > > <?PHP > $linkID = dbconnect($server, $username, $password, $database) or > die("Could not connect to host." . mysql_error()); > ?> > > > with that function defined as: > > <?PHP > function dbconnect($server, $username, $password, $database) { > mysql_connect($server, $username, $password) or die("Unable to > connect: ".mysql_error()); > > mysql_select_db($database) or die("Unable to select > database:".mysql_error()); > > > } > ?> > > that will not work on my rss feed. But it does work on my main page > which uses the dbconnect script. The only error that I'm getting is > the one set in my dbconnect call... "Could not connect to host". > > So can anyone see where I'm missing my comma or semicolon? :) > Are the MySQL ports open and available on both servers? Thanks, Ash http://www.ashleysheridan.co.uk