Hey all, just a quick question (should be an easy fix I think). In a WHERE statement in a query, is there a way to have multiple columns contained inside? Here is my code:
$sql="SELECT * FROM $tbl_name WHERE username='$myusername' and pwd='$pass'";
What I want to do is add another column after the WHERE (called priv_level = ‘$privlevel’). I wasn’t sure of the syntax on how to do that however.
Thanks for the help!
Read up on SQL. But anyways, to do it just add
AND priv_level = '$privlevel'to the end of the SQL.This might be a pretty big step if you’re new to PHP, but I think you should read up on the
mysqliclass in PHP too. It allows much safer execution of queries.Otherwise, here’s a safer way: