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 CRUD Operations with PHP Creating Records Adding Tasks

How to check if value already exists to avoid duplicate entries?


how can I check in SQL oe PHP if a row is already defined e.g. by title? For example I Don't want to add a task "grab a coffee" twice. Instead I want to have a notice that this entry already exists.

Any help is appreciated. Cheers Magnus

Its MySQL right?

2 Answers

u want a check?

SELECT COUNT(column_name) FROM table_name WHERE column_name = $user_input

if =1 than it ready exits. else insert new entry?

Yes it is mySQL.