# Miscellaneous > Database Programming >  Ask help with the first login page

## Ann92

I try to create my first login page of web database application. I am using PHP/MySQL in Dreamweaver MX. I am using Apache web service. I have searched a lot of web site. I couldn't find anything to help my start. There are a lot of ASP demo or wizard. But I have to do with PHP/MySQL in Dreamweaver MX. Hope I can find some experts help with my application. 

Thanks a lot!

----------


## ccalender

Do you have your database created?  If so, what is the schema?

----------


## ccalender

Any other details such as your code that you have developed so far would be extremely helpful as well.

----------


## ccalender

Hello,

I sent you a message, but I thought I would post the response in case anyone else has questions about this same thing.



// Variables Passed from Login Form

$username
$password


<?

// Database Variables
$dbhost = "localhost";
$dbname = "database_name";
$dbuser = "root";
$dbpwd = "";



mysql_connect($dbhost,$dbuser,$dbpwd)
	or die("<br>ERROR: Unable to connect to database server.<br>\n");

$dbquery = "SELECT username, password FROM users WHERE username='$username' AND password='$password'";


$result = mysql_db_query($dbname,$dbquery)
	or die("<br>ERROR: Unable to Insert & Update records.<br>\n");

$count = mysql_num_rows ($result);

mysql_close();


if ($count > 0) {
	// Then there is a match, so they should be granted access
} else {
	// There was not a match, so they are not allowed in or they entered in a bad username and password combination
}

?>


This is not the only way to do this, but it does work.  Someone may have a better solution, but I know this works and can be the basis for most look-up type functions.

----------

