Confusing Problem

From: Date: Sun, 20 Jan 2002 22:36:29 +0000
Subject: Confusing Problem
Groups: php.general 
Request: Send a blank email to php-general+get-81287@lists.php.net to get a copy of this message
I am really baffled by this problem. I have tried so many things to get this working but to no avail. Here is the actual code: function verify_user($username, $password){ $conn = mysql_connect($db_host, $db_user, $db_pass) or die("Error while connecting to Database System."); $select_db = mysql_select_db($db_name) or die("Error could not select the database"); $query = "SELECT FROM users WHERE username='$username'"; $result = mysql_query($query) or die("Unable to get query"); $rows = mysql_fetch_array($result); $password = md5($password); if($rows["password"] == $password){ print "You have been verified as $username.<br>"; print "Registering your session.<br>"; } else{ print "Error: Bad username or password.<br>"; print "Please go <a href=\"/?page=admin&step=1\">back</a>"; } } Anyways the problem is I cannot get it to even get to the database. It works when I try to connect in the actual code before I call this function. Like for example in index.php $conn = mysql_connect($db_host, $db_user, $db_pass) or die("Error while connecting to Database System."); $select_db = mysql_select_db($db_name) or die("Error could not select the database"); verify_user($username, $pass); But when I do it that way it won't let me run a query right. I am so baffled. Any input would be appreciated. Thanks. ------------------------------------------------------------- Tj Corley tcorley@theplanet.com The Planet

« previous php.general (#81287) next »