pgrevents Posted April 24, 2009 Share Posted April 24, 2009 What i am trying to do is a login script that when the email address in the query shows the activated status at no redirects to a page and if yes continue login. now i kinda know the php but not the mysql query. Heres how i think it would work 1. user logs in and sends post data to login.php 2. the email/username provided will be captured by $username 3. the mysql query searches database for that $username and colname'activated' 4a. if activated says no redirect to activate page 4b. if activated says yes continue log in ....... Is there a tutorial out there cause i have not found it yet. Or is my thinking so far past the line i cant see it any help would be greatly appreciated thanks peeps Quote Link to comment https://forums.phpfreaks.com/topic/155516-mysql-query/ Share on other sites More sharing options...
premiso Posted April 24, 2009 Share Posted April 24, 2009 $email_address = isset($_POST['email_address'])?mysql_real_escape_string($_POST['email_address'])?''; $sql = "SELECT activated FROM table_name WHERE `email_address` = '{$email_address}' LIMIT 1"; $result = mysql_query($sql); $activated = mysql_result($result, 0, 0); if ($activated == "no") { header("Location: login.php"); }else { header("Location: loggedin.php"); } Just a rough example of how it could be done. Hopefully that gets you going on your feet. If not google PHP Login Tutorial and you should find plenty of full out examples of how to do a login system. Quote Link to comment https://forums.phpfreaks.com/topic/155516-mysql-query/#findComment-818406 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.