On Wed, 2005-01-26 at 12:44 +0200, it clown wrote: > $db_user = $_POST["txt_name"]; > $db_password = $_POST["txt_password"]; > $db_name = "data"; > $connection = @mysql_connect ($db_host, $db_user, > $db_password) or die ("error connecting"); > echo "connection successful!"; > ?>
Replace this line - $connection = @mysql_connect ($db_host, $db_user, $db_password) or die ("error connecting"); - with this one - $connection = @mysql_connect($db_host, $db_user, $db_password) or die ("Error connecting : " .mysql_error()); - so you can debug better. However take a look here www.php.net/mysql_connect . $db_user and $db_password are the username and password to log on the MYSQL DATABASE. You probably want to login from a database table which will contain a password and username field. Here's an example : $dbHandle = mysql_connect($host, $user, $pass) or die (mysql_error()); mysql_select_db($db_name); $sql = "SELECT * FROM `table_name` WHERE `user_field` = '" . $_POST["txt_name"] . "' AND `pass_field` = '" . md5($_POST["txt_password"]) . "' LIMIT 1"; $result = mysql_query($sql, $dbHandle); if(mysql_num_rows($result)!=0) /* Logged on */ else /* Invalid Username/Password */ There're lots of tutorials out there, google's your friend. P.S. This is my first message on this maillist so I want to say hello to everyone ;-) -- Josip Dzolonga, dzolonga at mt dot net dot mk -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php