mr_nabo Posted March 30, 2007 Share Posted March 30, 2007 Hi, Hope you can help me with my code. I can't seem to figure out how to set up a MySQL-based password and username php app. Here's my code, it just goes blank when I run it and I can't figure out why. Anyone help? Thanks <?php require_once('header.inc'); ?> <?php require_once('dbconnect.php'); // Select the Database if (!@mysql_select_db('wedding')) { exit('<p>Can\'t select the WEDDING database</p>'); } session_start(); $_SESSION['logged'] = 0; if (isset($_POST['submit'])) { $sql = "SELECT * FROM people WHERE username='$_POST['username']'"; //make sure tablename and username match your form and database $sql = mysql_query($sql); $result = mysql_fetch_assoc($sql); if($_POST['username'] == $result['username'] && $_POST['password'] == $result['password']) { $_SESSION['user'] = $result['id']; $_SESSION['logged'] = 1; exit('Login success'); } else { exit('Login Failed. Please try putting in your details again'); } ?> Link to comment https://forums.phpfreaks.com/topic/44895-cant-get-usernamepassword-mysql-based-retrieval-working/ Share on other sites More sharing options...
neel_basu Posted March 30, 2007 Share Posted March 30, 2007 Insert This print_r($_SESSION); before exit('Login success'); and then tell what its showing Link to comment https://forums.phpfreaks.com/topic/44895-cant-get-usernamepassword-mysql-based-retrieval-working/#findComment-218120 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.