Hi i am having difficulty creating a login system for a project. The error i get is
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\project\studentregister.php on line 5
Database error: Access denied for user 'ODBC'@'localhost' (using password: NO)
my php code is
studentregister.php
<?php
require "student_db.php";
$link = mysql_connect( $db_host, $db_username, $db_password ); // connection to database
if ( !$link )
exit ( "Database error: " . mysql_error() );
mysql_select_db ( $db_name, $link ); // selects database name
$username = $_POST ['username'];
$password = $_POST ['password'];
$result = mysql_query( "INSERT INTO studentreg (username, password) VALUES('$username', '$password')", $link ); // insert post into db
if( !$result )
exit ( "Query failed: " . mysql_error() );
?>
student_db.php
<?php
$db_name = "project";
$db_host = "localhost";
$db_user = "root";
$db_pass = "";
?>
in my html file i have
<form name="login" method="post" action="studentregister.php">
<br>
<table width="560" border="1" cellpadding="2" cellspacing="2" bordercolor="#000000" class="text">
<tr>
<td class="text" align="center">Student Registration <BR>
<BR>
</td>
</tr>
<TR>
<TD>
<TABLE class="tablesalt" id="Table1" cellSpacing="0" cellPadding="1" width="560" border="0">
<TR>
<TD class="boldtext" height="10" width="194"></TD>
<TD height="10"></TD>
<TD height="10"></TD>
</TR>
<TR>
<TD class="boldtext" height="10" width="194"></TD>
</TR>
<TR height="10">
<TD class="boldtext" width="194">Username</TD>
<TD><input name="username" type="text" maxlength="20" id="Username" class="textboxes" style="width:150px;" /></TD>
<TD></TD>
</TR>
<TR class="Rows">
<TD class="boldtext" width="194">Password</TD>
<TD><input name="password" type="password" maxlength="20" id="Password1" class="textboxes" style="width:150px;" /></TD>