Re: Weird Problem In mysql_connect();
| From: | Jonathan Hilgeman | Date: | Fri, 31 Aug 2001 20:54:47 +0000 |
| Subject: | Re: Weird Problem In mysql_connect(); | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-12064@lists.php.net to get a copy of this message | ||
You mean you had all this inside a function? Like:
function dbConnect ()
{
$link = mysql_connect($host,$user,$pass);
}
?
If so, did you pass $host, $user, and $pass to the function by global-ing
them like:
function dbConnect ()
{
global $host;
global $user;
global $pass;
$link = mysql_connect($host,$user,$pass);
}
-OR-
function dbConnect ($host,$user,$pass)
{
$link = mysql_connect($host,$user,$pass);
}
- Jonathan
"Dave Watkinson" <d.watkinson@mightymatch.com> wrote in message
news:7CB9A13377EBE542BA2C8146178E8C7B0883C3@bigbertha.mmhome.co.uk...
yeah - everything's fine! All the variables are being stored, but
they're not getting passed to mysql_connect() for some really strange
reason!
:-(
I've done a temporary fix - moved the entire database connection
function to a separate file, and required that from the first required
file (!), and it's working, but the original problem has still got me
confused!!!
Dave
-----Original Message-----
From: Brunner, Daniel [mailto:daniel.brunner@duni.com]
Sent: 31 August 2001 21:32
To: Dave Watkinson
Subject: RE: [PHP-DB] Weird Problem In mysql_connect();
Hello!!
Have your tried to echo the $host??
like
$host=123.100.321.1
echo $host;
Dan
> ----------
> From: Dave Watkinson
> Sent: Friday, August 31, 2001 3:17 PM
> To: PHP-DB List (E-mail)
> Subject: [PHP-DB] Weird Problem In mysql_connect();
>
> Hey all
>
> I can connect with $conn =
> mysql_connect("IP_Address","username","password");
>
> but I can't connect with
> $host = "IP_Address";
> $user = "username";
> $pass = "password";
>
> $conn = mysql_connect($host,$user,$pass);
>
> Any ideas? All I get is "Can't connect to MySQL Server on 'localhost',
> which is kinda weird cos I'm actually specifying a (different) IP
> address in the host argument.
>
> I know it wasn't broken, but I decided to try and fix it anyways!!!
>
> TIA!
>
>
> Dave
>
>
>