[thelist] MYSQL Connecting problems

Kae Verens kverens at contactjuggling.org
Thu Feb 27 08:42:00 CST 2003

Rob Whitener wrote:
> From: CDitty [mailto:mail at redhotsweeps.com]

> This is my connection string.
> $db = mysql_connect("mysql.addr.com", "$userid", "$password");
> mysql_select_db("$database",$db);
> I have verified the database server is correct.  The user id and password
> is correct.  Can anyone offer any advice?  I have never come across this
> error that could not be fixed.  Scripts in another directory work fine
> using this same database server address.

why don't you write a file called db.php which connects to the database,
then just include that in any files that need database access? it seems
to me that you are rewriting code that should really by centralised, and
this is causing errors.

if you think you're having a headache now - wait until you're asked to
move the site onto a new hosting server and have to rewrite the
connections... you'll thank your centralisation then...

Kae Verens               _______\_   webworks.ie
pay:  www.webworks.ie       _____\\__   webhosts
play: www.contactjuggling.org  ___\\\___  design
  kae: kverens.contactjuggling.org _\\\\____ code

More information about the thelist mailing list