[php]
<?php error_reporting(E_ALL); session_start(); $host="localhost"; $username="root"; $password="alexi"; $db_name="users"; $tbl_name="accounts"; mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name") or die("cannot select DB"); $username=$_POST['username']; $password=$_POST['password']; $sql="SELECT * FROM `accounts` WHERE `username`='".$username."' and `password`='".$password."'"; $result=mysql_query($sql) or die ( mysql_error () ); $count=mysql_num_rows($result); if($count==1) { $_SESSION['username'] = $username; if(isset($_SESSION['username'])) { echo 'You are logged in'; } } else { echo 'incorrect'; } ?>[/php]
When I try to login, It reads “Incorrect”. I’m entering the correct password though, so I’m not sure why it’s not working…