Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

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