Hi I am brand new to PHP/MySQL development, and I'm following through the Build Your Own Database Driven Web Site 4th Ed. text. I've installed PHP, MySQL, and Apache separately and have used the following code to connect to MySQL:
Code PHP:<?php $link = mysqli_connect('localhost', 'root', 'PASSWORD'); if (!$link) { $output = 'Unable to connect to the database server.'; include 'output.html.php'; exit(); } if (!mysqli_set_charset($link, 'utf8')) { $output = 'Unable to set database connection encoding.'; include 'output.html.php'; exit(); } if (!mysqli_select_db($link, 'ijdb')) { $output = 'Unable to locate the joke database.'; include 'output.html.php'; exit(); } $output = 'Database connection established.'; include 'output.html.php'; ?>
This is verbatim from the book (except I use the correct password for the root user). When I load it up in a browser I do not get any of the error messages, but I do get a totally blank page. What does this mean? When I declare $link to be zero, I do get the first error message. Any thoughts would be very helpful.
Thanks, Grace






Bookmarks