William J. Terrell17,403 Points
I'm not seeing how the URLs for the shirts are working... [SOLVED]
In the video, he enters the URL in the form of "localhost/shirts/108". I'm not seeing how that works, as I would assume that, given that format, the browser would be looking for a page called 108 in the shirts folder, correct?
My instance of the project works just fine, with exception to this detail. Whenever I click on a shirt from the listings page, I get a 404.
What's more, when I type in a "108" in the Search page, it also says there are no results.
I see what was going on now; there was no index.php in the shirts subfolder, and it was using a RewriteRule in the .htaccess file to set shirts.php to function as the landing page whenever you navigate there.
Because my files are in a deeper nested folder - htdocs/treehouse/PDO_tutorial - I just needed to update the RewriteRule in the .htaccess file to reflect that.
The rule that was written there was:
RewriteRule ^/shirts/$ /shirts/shirts.php
I just had to update it to:
RewriteRule ^shirts/$ /treehouse/PDO_tutorial/shirts/shirts.php
And now it works :)
In this instance, I think the 108 is a directory, not a page name. An html page should have an extension on it like .htm or .html (or .php).
Kevin Korte28,094 Points
That URL is querying the database using a $_GET variable, and returning an array based on if a product has the SKU number from the URL. If it does, it's returning that information back.
Michael Dowell2,390 Points
(Hmm... I just tried to post this answer previously and got a 500 error from teamtreehouse.com.. ok I will try again...)
I have a similar problem. This link: http://localhost:8888/shirts/108/
results in this error: 404 page not found
I have downloaded the new improved .htaccess file from the downloads page at this link: https://teamtreehouse.com/library/using-php-with-mysql/filtering-input-for-queries/refactoring-shirt-details
I copied the .htaccess contents to my htdocs folder in MAMP.
And the result was the error changed to: Server Error 500
Not sure how to make this work. Any suggestions?