Ask Experts Questions for FREE Help!
 

Free Answers in 3 Easy Steps

Register Now
3 Steps
 


Ask QuestionsprogressAnswer QuestionsprogressBuild ReputationprogressBecome an Expert
 
At Ask Me Help Desk you can ask questions in any topic and have them answered for free by our experts. To ask questions or participate in answering them you must register for a free account. By registering you will be able to:
  • Get free answers from experts in any of our 300+ topics.
  • Accept money for answers that you provide.
  • Communicate privately with other members (PM).
  • See fewer ads.
  View Answers    Answer this question    Ask a question  
 

sypher373
Mar 6, 2007, 07:43 AM
Hello all,

Just a little background on my system.

I am running Windows XP Pro SP2. Firewall is disabled.

Running Apache 2.2, PHP5 and MySQL server 5.1.

I am trying to simple interface with my MySQL database using a webpage running PHP. I have tried using the mysql_connect(host, name, password) function, checked all the parameters 50,000 times and I still cannot connect. As a test, I wrote a small script that resembled this:

<?php

Echo "start";
Mysql_connect($host, $name, $pass);
Echo "end";

?>

The problem with that is, only the "start" printed. I have no indication that I ever got connected to the database, as the insertion of a create db command yielded nothing. I have even tried the connection function using the 'or die("Error"); part. No error, no connection.

MY firewall is turned off, MySQL operates fine at the command line, and apache is working fine. All PHP commands work, I just can't seem to interface with MySQL.

Any suggestions? :confused: :confused:

I forgot to mention, this is all being run on the same machine, making my hostname localhost. I have tried localhost as well as 127.0.0.1

BenReilly
May 10, 2007, 11:25 PM
Try the following:
<?PHP
$db_server = 'localhost';
$db_name = 'whateveritis';
$db_user = 'root';
$db_passwort = 'password';

$db = @mysql_connect($db_server, $db_user, $db_passwort)
or die ('The Connection could not be established');

$db_check = @mysql_select_db($db_name);

If($db)
echo 'Connection to Database is established';
?>
If you are connected to the db you will receive the last message.

interinfinity
Jan 11, 2008, 03:48 PM
Make sure mysql services running in services.msc, try restarting apache and msql servies