Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Using PHP with MySQL Filtering Input for Queries Using a WHERE Clause

Shirts.php link no longer working. Neither are the individual shirt pages...

I downloaded the projects files and the only thing i altered is the config.php file since i'd put everything in a seperate "shirts4mike" folder inside of my htdocs directory. Since i have multiple projects in there. That works fine, only the link to shirts no longer works. It points to "http://localhost/shirts4mike/shirts/" where it should be pointing to "http://localhost/shirts4mike/shirts/shirts.php". Also, when i click on a shirt ( on the homepage or on the shirtspage, same thing happens. I think it should be a problem with my .htaccess file but i have no idea how that works so here it is:

RewriteEngine On
RewriteRule ^shirts/$ /shirts/shirts.php
RewriteRule ^shirts/([0-9]+)/$ /shirts/shirt.php?id=$1
RewriteRule ^receipt.php$ /receipt/ [R=301]
RewriteRule ^contact.php$ /contact/ [R=301]
RewriteRule ^shirts.php$ /shirts/ [R=301]
RewriteRule ^(shirts/[0-9]+)$ /$1/ [R=301]

RewriteCond %{QUERY_STRING} ^id=([0-9]+)$
RewriteRule ^shirt.php$ /shirts/%1/? [R=301]

Also, so you can see what i did, my config.php file:

<?php

    // these two constants are used to create root-relative web addresses
    // and absolute server paths throughout all the code

    define("BASE_URL","/shirts4mike/");
    define("ROOT_PATH",$_SERVER["DOCUMENT_ROOT"] . "/shirts4mike/");

    define("DB_HOST","localhost");
    define("DB_NAME","shirts4mike");
    define("DB_PORT",""); // default: 3306
    define("DB_USER","root");
    define("DB_PASS","");

1 Answer

Stephen Pierce
Stephen Pierce
12,047 Points

It looks like you may need to add the password to the config.php file.