I'm reading Kevin Yank's Database Driven Websites and I can't get past chapter 4, because I cannot connect to my Apache server. I've spent hours trying to figure this out and it's driving me crazy. This is the code:
$link = mysqli_connect('127.0.0.1', 'root', 'password');
$output = 'Unable to connect to the datbase server.';
if (!mysqli_set_charset($link, 'utf8'))
$output = 'Unable to set database connection encoding.';
if (!mysqli_select_db($link, 'ijdb'))
$output = 'Unable to locate the joke database.';
$output = 'Database connection established.';
I changed to password to reflect my password and I've tried localhost and 127.0.0.1.
Everything is configured correctly. I looked at the other post on this titled: Build your own Database Driven Webiste, Chapter 4 and none of it worked for me. I keep getting this error message:
Warning: mysqli_connect() function.mysqli-connect:  No connection could be made because the target machine actively (trying to connect via tcp://127.0.0.1:3306) in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\connect\index.php on line 2
Warning: mysqli_connect() No connection could be made because the target machine actively refused it. in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\connect\index.php on line 2
I disabled my firewall and it didn't help. Apache is on Port 80. My PHP is 5.3.5 (thread safe version), and my Apache is 2.2.17.
Anything mention in that earlier post I tried. I made sure all the files were configured correctly. I reset, reset and reset Apache. What else do you need to know? I've been at this for hours!! Please help. Thanks in advance.
This isn't a coding issue, but an issues with identifying the correct login info.
By any chance have you tried using 'localhost' for the host. If this doesn't work, you could repost the question in the Apache forum section without the php references in the question.
You may also want to insert your actual password into the 'password' section as well. Not sure if you were doing that or not as I am sure you don't want to post your own personal password into the forums. I know that I did this when I was starting this chapter. It messed me up for about 20 minutes, thankfully nobody else was watching. haha. and what mdragotta1 said about the "localhost" thing instead of the IP address you are using may also help the problem.