Jump to content

Connectin to MySQL


watagal

Recommended Posts

Greetings,Newbie here. I realize this is a common question, but I have tried to research it on my own - but all examples illustrates what I already have below.Here's what I've done:I have Apache 2.0 running locally.I've installed PHP 5.0 locally.I have MySQL 4.1.11 service running (verified thru MySQL Administraor - I use the same host,user,pw here as I do in my script)I can display a PHP script in MS Internet Explorer v6, but when I add my DB connection code to the same script - nothing happens (in fact my previously working PHP code does not display).Is there some switch in Apache config, php.ini, or MySQL setting I'm missing?Thanks, watagalHere is my PHP code:

<html><head>  <meta http-equiv="Content-Language" content="en-us">  <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"></head><body>  <?php    // Database Connection . . . . . . . . . .    $host = "localhost"; // tried "127.0.0.1"    $user = "root";    $pw   = "password";    $connection = mysql_connect($host,$user,$pw) or die('Could not connect');    // If I comment out the abv statement, my code completes w/o error - but no connection (obviously)    echo "$host<br>$user<br>$pw<br>";  ?></body></html>

Link to comment
Share on other sites

Greetings,I tinkered w/ the "httpd.conf" file in Apache and restarted the Apache service in Win XP and now it works. Not really sure what fixed the problem or I would be happy to pass it on.Sorry for the bother.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...