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 Remembering Form Data

probably a simple mistake, help please!

I've probably made a simple mistake, but PHP code checker says there are no issues. I'm getting a fatal error:

Fatal error: Uncaught Error: Call to undefined method PDOException::get_message() in
/home/treehouse/workspace/inc/functions.php:59 Stack trace: #0 /home/treehouse/workspace/task.php(17):
add_task('1', 'Treehouse', '12/12/2012', '60') #1 {main} thrown in /home/treehouse/workspace/inc/functions.php on line 59

Does anyone see my mistake? my code is here:

http://w.trhou.se/etxqtiz16z

Thanks a $M

1 Answer

Joel Bardsley
Joel Bardsley
31,249 Points

Your add_task function has a typo in the SQL Insert statement:

$sql = 'INSERT INTO tasks(prject_id, title, date, time) VALUES(?,?,?,?)';

Make the correction to prject_id and see if that helps!