我在 MySQL 数据库中的数据是
“1”、“演示”、“演示 1”、“测试”
在 'echo $row[2]' 线上,它给出错误“注意:未定义的偏移量:2”
任何解决方案..?? PHP代码如下...
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
</head>
<body>
<?php
$uname=$_POST['txtUserName'];
$passwd=$_POST['txtPassword'];
$query="SELECT usernm,passwd FROM tbuserdemo WHERE usernm='$uname'";
$result= mysql_query($query);
$rows= mysql_num_rows($result);
if($rows==0)
{
echo "User Name is Wrong";
}
else
{
$row=mysql_fetch_row($result);
$encpasswd= encrypt(1, $passwd);
if ($row[1]==$encpasswd)
{
echo "Welcome $uname";
echo $row[2];
}
else
{
echo "Password is Wrong";
}
}
?>
</body>
</html>