if you require the file before calling mysql_connect(), the $user is set to $email. this means you are connecting to mysql using the username set in $email. you get access denied error because you use the wrong username or password to connect to mysql. before calling mysql_connect try echo the $user and $pass see if they are the correct. hope this help Foong "Addison Ellis" <addison@bellsouth.net> wrote in message news:a05010410ba4b2c6694e9@[65.80.190.170]... > hello, > i am trying to do the following: > case "login": > $connection = mysql_connect($host, $user,$password) //15 > or die ("Couldn't connect to server."); > $db = mysql_select_db($database, $connection) > or die ("Couldn't select database."); > > $sql = "SELECT email FROM accounts > WHERE email='$email'"; > $result = mysql_query($sql) > or die("Couldn't execute query."); > $num = mysql_num_rows($result); > if ($num == 1) // login name was found //25 > { > $sql = "SELECT email FROM accounts > WHERE email='$email' > AND password=password('$password')"; > $result2 = mysql_query($sql) > or die("Couldn't execute query."); > $num2 = mysql_num_rows($result2); > if ($num2 > 0) // password is correct > { > $auth="yes"; > //35 > $user=$email; > $today = date("Y-m-d h:m:s"); > $sql = "INSERT INTO login (loginName,loginTime) > VALUES ('$email','$today')"; > mysql_query($sql) or die("Can't execute query."); > header("Location: cat_ad.php"); > } > else // password is not correct > { > > in my config.php file which is a required file i have > $user=$email, etc. > i continually receive an access denied/couldn't connect to server. > i'm sure i'm leaving something out... > thank you for your time. addison > -- > Addison Ellis > small independent publishing co. > 114 B 29th Avenue North > Nashville, TN 37203 > (615) 321-1791 > addison@bellsouth.net > info@smipco.com > subsidiaries of small independent publishing co. > info@gloabaldog.com > info@momandpocentral.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php