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.

General Discussion

Krystel Hagan
Krystel Hagan
4,731 Points

PHP/SQL Project

Currently I am trying to link a web based document to a server with PHP. I took all the Treehouse courses for this and I am still a bit confused. Here is what I have so far, if anyone would even have an example of how this should look/be set up please feel free to share!

mysql_connect(server, user, password) mysql_select_db("database name") mysql_query(SELECT FROM ("database name")) mysql_fetch_assoc("file/doc inside the database I would like to grab")

Thank you!

1 Answer

David Kaneshiro Jr.
David Kaneshiro Jr.
29,247 Points

Hi Krystel Hagan,

Check out the first example in the following php.net manual page for the mysql_fetch_assoc function:

http://www.php.net//manual/en/function.mysql-fetch-assoc.php

I believe it is a good starting point. The example is concise, uses all the functions you plan to use, and it shows you how they would work with each other.