Can't get a MySQL connection either

------=_NextPart_000_0B6D_01C74FB2.FF118620
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit

This is posted by another user and I am also trying for answers at the
MySql-PHP list:

When entering the following, I do not get a response in any fashion from the
developmental server on my system, just a blank page. Any ideas how I can
complete the connection?

<!doctype html public "-//W3C//DTD HTML 4.0 //EN"> <html> <head>
<title>MySql</title>
</head>
<body>
<?php
$dbServer='localhost';
$dbUser='root';
$dbPass='';
$dbName='test';
$link = mysql_connect("$dbServer", "$dbUser", "$dbPass") or die("Could not
connect");
print "Connected Successfully<br>";
mysql_select_db("$dbName") or die("Could not select database");
print "Database selected successfully<br>";
mysql_close($link);
?>
</body>
</html>


Vince Bravdica
President
Virtual Web Resources
<http://www.vwebr.net/> www.vwebr.net


_____

I am using the free version of SPAMfighter for private users.
It has removed 2457 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter <http://www.spamfighter.com> for free now!


------=_NextPart_000_0B6D_01C74FB2.FF118620--
Vince Bravdica [ Mi, 14 Februar 2007 05:07 ] [ ID #1628972 ]

Re: Can't get a MySQL connection either

--=_alternative 004F9F8986257282_=
Content-Type: text/plain; charset="us-ascii"

| This is posted by another user and I am also trying for answers at the
|MySql-PHP list:
|
| When entering the following, I do not get a response in any fashion from
the
| developmental server on my system, just a blank page. Any ideas how I
can
| complete the connection?
|
| <!doctype html public "-//W3C//DTD HTML 4.0 //EN"> <html> <head>
| <title>MySql</title>
| </head>
| <body>
| <?php
| $dbServer='localhost';
| $dbUser='root';
| $dbPass='';
| $dbName='test';
| $link = mysql_connect("$dbServer", "$dbUser", "$dbPass") or die("Could
not
| connect");
| print "Connected Successfully<br>";
| mysql_select_db("$dbName") or die("Could not select database");
| print "Database selected successfully<br>";
| mysql_close($link);
| ?>
| </body>
| </html>
|
| Vince Bravdica

Vince,

Maybe add mysql_error() inside your die statment after trying to connect:
$link = mysql_connect("$dbServer", "$dbUser", "$dbPass") or die("Could not
connect" . mysql_error());
--=_alternative 004F9F8986257282_=--
dpgirago [ Mi, 14 Februar 2007 15:29 ] [ ID #1628978 ]

Re: Can't get a MySQL connection either

--------------enig861C3836767AD09910A5A652
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

> This is posted by another user and I am also trying for answers at the
> MySql-PHP list:
>
> When entering the following, I do not get a response in any fashion
> from the developmental server on my system, just a blank page. Any
> ideas how I can complete the connection?

> <!doctype html public "-//W3C//DTD HTML 4.0 //EN"> <html> <head>
> <title>MySql</title>
> </head>
> <body>
> <?php
> $dbServer=3D'localhost';
> $dbUser=3D'root';
> $dbPass=3D'';
> $dbName=3D'test';
> $link =3D mysql_connect("$dbServer", "$dbUser", "$dbPass") or die("Coul=
d
> not connect");
> print "Connected Successfully<br>";
> mysql_select_db("$dbName") or die("Could not select database");
> print "Database selected successfully<br>";
> mysql_close($link);
> ?>
> </body>
> </html>

1. $link =3D mysql_connect($dbServer, $dbUser, $dbPass) or die("Could not=

connect");

2. mysql_select_db($dbName) or die("Could not select database");

I removed the characters " because those are variables.



--------------enig861C3836767AD09910A5A652
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)

iQEVAwUBRdPrZbXBHi2y3jwfAQppNQf/YuPJB1k7TziPzU0ktvwqKD8xb3d5 5sMY
+AN6GisjV6QulqR9x3jEyLEbZ2yopIdWYgeOB15SBKXTwr9j/EdISrsX8f8C RQW4
cGRyjn30VPdEAYyk8HzGiG0hj/cmses1405fqAsz6JC7CGURI0vvICNPQbjx yyjY
cQ0/f5IlpvKYEzBCuR1kIyq2xaumFn5U0iMvHgZzQy9QG1Dvtv9In99R0ZNl 0FxD
RYfuTnnsOX1CgLRH1lsQzsYuEk6wZdSErLdV353qBb1xl1rya4o614hELyb4 fjXT
bEJoHsmIq+9bwNxSseBQ9n2rj05P7r2d2cLFIia17jE0/VGFd/Ud/g==
=T/Qa
-----END PGP SIGNATURE-----

--------------enig861C3836767AD09910A5A652--
Michael Louie Loria [ Do, 15 Februar 2007 06:11 ] [ ID #1630044 ]
Datenbanken » gmane.comp.db.mysql.windows » Can't get a MySQL connection either

Vorheriges Thema: No output after mysql_connect
Nächstes Thema: Regarding Update the structure of table