PHP Using PHP with MySQL Querying the Database with PHP Modifying Model Code

Project File

I uploaded the shirts4mike project files onto my server and the index.php file is showing a blank white page in the browser. I was able to set up the database.php file in the previous section, but I can continue until I get the site working. Any ideas on what might be happening? I haven't touched any of the project files yet.

This is what the index.php page looks like for me http://jbeanmedia.com/Treehouse/index.php

I appreciate any help. Thanks!

4 Answers

Chris Dziewa
Chris Dziewa
17,781 Points

Have you forgotten a semi-colon on one of your lines? Usually punctuation is responsible for the white page but it is possible that something else is causing it. Also you can set-up an error message if the database isn't working properly. Try posting your index.php code here.

Thanks for the reply. I haven't put the database files into the project files yet. I just downloaded the files and uploaded them to my server. I tried to run the index.php file in my browser to make sure everything was working and got the white page. These are the files directly from Treehouse. Any idea?

Chris Dziewa
Chris Dziewa
17,781 Points

Did you put it at the root of the server you are using? Also, you might want to take a look at the config file and see if you need to change anything there. If you downloaded the project files from the video on the right of this post, it may be giving you a problem because you have shirts on the index page that are taken from the database. This database isn't set up on your server but it is in the project files. This is in the database.php file and the configuration is taken from your config.php file. You could remove any code referencing your products from the index.php to see if it works, or you could set the error message to display if it can't access the database. Of course you could also make your own database an change the config file.

Chris Dziewa
Chris Dziewa
17,781 Points

Actually, why don't you try to comment out the require(ROOT_PATH . "inc/database.php"); in the last function on products.php. Then uncomment all of the shirts in that same function so you can see if it works again. This will switch your index/shirts page to using the shirts array instead of the database.

Have you set up the config.php file with the correct information to connect to your database?