Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Connecting PHP to MySQL - Selecting products

In the code challenge it asks me to write the SQL query to select 'name' and the 'price' from the 'products' table.

My code is: SELECT name, price FROM products;

It tells me this is wrong, and I don't know why.

4 Answers

It should actually be:

SELECT `name`, `price` FROM `products`;

I have try this ...

< SELECT name, price FROM products

No luck

looks right to me.. are you sure it is products ( plural) and not 'product'?

Yes, the column names and table name are definitely correct.

Have you tried it again, I was having a problem with a different code challenge last night and it turned out that there was a problem with the challenge engine, they fixed it last night

You don't need a semi-colon at the end. It's just:

SELECT name, price FROM products