tbobker Posted July 5, 2006 Share Posted July 5, 2006 What is wrong with this?Here is my login part: [code]<html><body><div align="center"><form method="post" action="login.php"> Username: <input type="text" name="username"><br> Password: <input type="text" name="password"><br> <input type="submit"></form></div></body></html>[/code]and here is the login script:[code]<?php include("dbconnect.inc"); $sql = "select * from login"; $result = mysql_query($sql, $conn); $row = mysql_fetch_assoc($result); if($_POST[username] && $_POST[password] == $row[username] && $row[password]){ include("index.php"); } else { echo "wrong login <a href='index.html'>Go back</a>"; } ?>[/code]Why isnt it working? there are no errors just wont login. Link to comment https://forums.phpfreaks.com/topic/13776-help-what-is-wrong-with-my-login-script/ Share on other sites More sharing options...
mschrank Posted July 5, 2006 Share Posted July 5, 2006 Try $row[0]['username'] etc...the best thing to do if that doesn't work is print_r($row) which will show you the data structure of the array so you can code accordingly.Good luck. Link to comment https://forums.phpfreaks.com/topic/13776-help-what-is-wrong-with-my-login-script/#findComment-53537 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.