light85
January 13th, 2005, 06:37 AM
Hi, i have a login page:
<html>
<head>
<title>Welcome to ET0023 Login</title>
</head>
<form name="form1" method="post" action="login.php">
<table width="75%" border="0">
<tr>
<td width="23%">Your Username:</td>
<td width="77%"><input name="username2" type="text" id="username23"></td>
</tr>
<tr>
<td height="31">Your Password:</td>
<td><input name="password2" type="password" id="password23"></td>
</tr>
</table>
<p>
<input type="submit" name="Submit2" value="Log In">
</p>
</form>
</body>
</html>
login.php
<?
$username=$_POST['username2'];
$password=$_POST['password2'];
$db = mysql_connect("localhost", "root", "hsienhwee") or die ('My SQL Error: ' . mysql_error());
mysql_select_db("people",$db);
$stuff = mysql_query("SELECT * FROM `users` WHERE Username='".$username."' AND password='".$password."'") or die("MySQL Login Error: ".mysql_error());
if (mysql_num_rows($stuff) > 0) {
$row=mysql_num_rows($stuff);
echo "You have logged in as $username <br>";
} else {
echo("Login Incorrect. Please Try Again!");
}
?>
and after i enter the username and password and submit, i got this error:
Fatal error: Call to undefined function mysql_connect() in c:\Inetpub\wwwroot\test\login.php on line 4
What went wrong? Thanks in advance for any help given.
<html>
<head>
<title>Welcome to ET0023 Login</title>
</head>
<form name="form1" method="post" action="login.php">
<table width="75%" border="0">
<tr>
<td width="23%">Your Username:</td>
<td width="77%"><input name="username2" type="text" id="username23"></td>
</tr>
<tr>
<td height="31">Your Password:</td>
<td><input name="password2" type="password" id="password23"></td>
</tr>
</table>
<p>
<input type="submit" name="Submit2" value="Log In">
</p>
</form>
</body>
</html>
login.php
<?
$username=$_POST['username2'];
$password=$_POST['password2'];
$db = mysql_connect("localhost", "root", "hsienhwee") or die ('My SQL Error: ' . mysql_error());
mysql_select_db("people",$db);
$stuff = mysql_query("SELECT * FROM `users` WHERE Username='".$username."' AND password='".$password."'") or die("MySQL Login Error: ".mysql_error());
if (mysql_num_rows($stuff) > 0) {
$row=mysql_num_rows($stuff);
echo "You have logged in as $username <br>";
} else {
echo("Login Incorrect. Please Try Again!");
}
?>
and after i enter the username and password and submit, i got this error:
Fatal error: Call to undefined function mysql_connect() in c:\Inetpub\wwwroot\test\login.php on line 4
What went wrong? Thanks in advance for any help given.