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

Elian Kloppenburg
Elian Kloppenburg
22,903 Points

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.