Everything gets passed to 'login' correctly, however it never manages to make it to the query inside the login function. (see comment) There may be other things wrong with the code, but I really just need to figure out why I cant get connected. P.S. All of the Database info works correctly on other pages, so it's not that (and yes, some things have been removed) [code] <?PHP define("host", ""); define("UNAME", ""); define("pword", ""); $conn = mysql_connect(host,UNAME,pword) or die(mysql_error()); $db = mysql_select_db('db173735005'); function login($u, $p) { $sql = "SELECT * FROM users WHERE username = '".$u."'"; $result = mysql_query($sql, $conn) or die("Error!"); $res = mysql_fetch_assoc($result); echo "Test!\n\n"; echo $res['password_hash']; if ($res['password_hash'] === $p) { session_start(); $_SESSION['username'] = $u; $sesid = microtime().$u.microtime().rand(0, 1000); $_SESSION['sessid'] = md5($sesid); $_SESSION['accesslevel'] = $res['accesslevel']; $sql2 = "UPDATE `users` SET `sess_hash` = '".$_SESSION['sessid']."' WHERE `username` ='".$u."' LIMIT 1" ; $updated = mysql_query($sql2) or die("Not Updated!"); return 1; }else{ return 0; } }//End of Func_Login ?> <? if (isset($_POST['username']) && isset($_POST['pass'])) { if (!empty($_POST['username']) && !empty($_POST['pass'])) { $user = $_POST['username']; $pass = md5($_POST['pass']); mysql_real_escape_string($user); mysql_real_escape_string($pass); if (login($user, $pass) == 1) { echo "Logged In!"; echo "Add js here to push to next page."; } else { echo "Bad Username/Pass. Try again."; echo "$pass"; echo "$user"; } } } ?> [/code]