Need help connecting to MySql from PHP
Please be patient with me as I try to explain my problem, I'm a total newb to all of this. I could really use some assistance on this as I have searched for days trying to find the answer and have failed to find the answer.
The setup you need to know:
1) Apache Server is installed and up and running fine
2) MySql service is running
3) I can use mysql through command console to see my DB and tables
4) I'm running on Windows XP Media Edition
As I work my way through the tutorials in the SitePoint Book titled "Build your own Database Driven Web Site, Using PHP and MySQL" everything worked fine; installation of Apache, installation of MySQL, and even the chapters on adding tables..etc. The problem occurs when I get to the part where I have to connect to MySql through PHP.
When I type http://localhost:8080/test/chapter4/connect and hit enter in the browser I get nothing...ziltch...nada...If I view source it's empty. I've tried variations of connections and still I'm getting nothing. HALP! what am I doing wrong? For those of you familiar with the book I'm stuck on page 121.
I suspect the problem is something related to the root of mySql but I haven't been able to figure out what. Is there something I have to do with mySql to tell it the root?
Two files (located at htdocs/test/chapter4/connect)
$link = mysqli_connect('localhost:8080', 'root', 'testpassword');
$output = 'Unable to connect to the database 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.';
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<?php echo $output; ?>