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

I am trying to work with MySQL

Hello dear ma'am. Greetings of the day.

This one is not working with MySQL ?

$user = findUserByEmail($email); if (!empty($user)) { $session->getFlashBag()->add('error', 'User Already Exists'); redirect('/register.php'); }

Thank You :-) @alena

1 Answer

Luc de Brouwer
seal-mask
.a{fill-rule:evenodd;}techdegree
Luc de Brouwer
Full Stack JavaScript Techdegree Student 17,939 Points

This has nothing to do with MySql and looks like just regular PHP code.

MySql with PHP requires a database connection, and by the looks of it you're using OOP PHP. So you will have to make a query that queries the database and let PHP handle the info that returns from that query to validate whether an user exists or not.