PHP Using PHP with MySQL Using Relationship Tables in MySQL Understanding Relationship Tables

Mark Lovett
Mark Lovett
15,853 Points

1. Why arent links working in the project files?

I loaded the files in htdocs. Seems like the htaccess file is missing. It should appear in Sublime text editor but it's not there.

The only links that arent working are related to the shirts. The shirts listing page address is http://localhost:8888/shirts/shirts.php This address http://localhost:8888/shirts/ gives me an index listing with 3 links.

All the shirt detail pages like http://localhost:8888/shirts/101 return 404's

Im using this project folder : project03-stage04-shirts4mike

Im working in PHP with mySQL Filtering Input for Queries.

4 Answers

Andrew Dushane
Andrew Dushane
9,264 Points

.htaccess is normally hidden by default. There are various ways to see/edit hidden files depending on your operating system. A quick google search ie 'Windows 7 show hidden files' should give you the ability to see if .htaccess exists and has the correct content.

Mark Lovett
Mark Lovett
15,853 Points

Thank you Andrew. It was missing the htaccess file. I did add my htaccess file and that helped. However, the shirt detail pages, like this http://localhost:8888/shirts/101/, are returning an error: "Data could not be retrieved from the database."

Mark Lovett
Mark Lovett
15,853 Points

The missing project file htaccess file was the problem. I imported the new tables into phpMyAdmin and it's all working now. Issue closed.

Eiyad Ziyadah
Eiyad Ziyadah
19,250 Points

Hi Mark,

i have the same problem now, where did you find the htaccess file??

Michael Dowell
Michael Dowell
2,390 Points

I found the .htaccess file at this link: https://teamtreehouse.com/library/using-php-with-mysql/using-relationship-tables-in-mysql/understanding-relationship-tables

click "downloads". Unzip the file.

The .htaccess folder is in the project files, but it is hidden.

To be able to see the hidden .htaccess folder, you must make hidden files visible. I'm on a mac, so this is how I do it.

To view hidden files on a mac, open terminal and paste this line of code (then press enter): defaults write com.apple.finder AppleShowAllFiles -boolean true ; killall Finder

To prevent hidden files from being seen, paste this line of code into terminal (then press enter): defaults write com.apple.finder AppleShowAllFiles -boolean false ; killall Finder

Hope this helps.