[PHP] A headache with includes and mysqli

camelCase

The Case of the Mysterious Camel.
Reaction score
362
So, I have a web-coder friend who's a bit of a newbie and won't share her code with me to debug but she gladly gave other bits of info. and expects me to find a solution.

So, her problem, after I spent about an hour talking to her is this:
She just started mysqli but she knows mysql. Normally, this works:
connection.php
database.php

database includes connection and can then connect to the DB with hostname and whatnot and perform MySQL operations.

But in her case, it always failed.
Warning: mysqli::mysqli() [mysqli.mysqli]: (28000/1045): Access denied for user 'SOMEHOST'@'localhost' (using password: NO) in
SOMEFILE SOMELINE

After a long time tinkering, she got it to work by changing:
$hostname = 'blah';
to:
define('DB_HOST', 'blah');

and just connecting using DB_HOST when using mysqli which worked for her.

Thing is, I've never encountered this before. Anyone here know why this works or what her possible problem could be?
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
889
I would have no idea other than wild speculation without looking at the code.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top