[PHP] comparing a variable to value in DB

2002-07-29 Thread Tyler Durdin
I have a column in my DB named username and i am trying to compare a session ID called $username to the field in my DB called username. The way i had done it before was SELECT * from tablename WHERE Tablename.username == $username, but this does not seem to be working is there a better way to

Re: [PHP] comparing a variable to value in DB

2002-07-29 Thread Kevin Stone
No trust me you're on the right track. You don't need the double == operator in the SQL query. Try something like this... $query = SELECT * FROM membersWHERE username = '$username'; $result = mysql_query($query, $db); if (mysql_num_rows($result) == 0) { echo The username i$username/u does