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 trialAbe Layee
8,378 PointsSQL select multiple queries with argument
I haven't done some mysql in a long time and I forgot how to select multiple statements with arguments.
This is my mysql query which is wrong. I am trying check if the user is admin before logging into the site.
if(isset($_POST['submit'])) {
$email = $_POST['email'];
$password = $_POST['passoword'];
$login_query = " SELECT * FROM user WHERE email='$email', password ='$password', AND role='admin' ";
$result= $connect->query($login_query);
```php
1 Answer
Steven Parker
231,269 PointsYou can combine comparisons in a WHERE clause with logical operators like "AND" and "OR", but no commas.