Home >Backend Development >PHP Tutorial >为什么一直提示错误 请人帮我看下

为什么一直提示错误 请人帮我看下

WBOY
WBOYOriginal
2016-06-23 14:00:23940browse

网页提示 Notice: Undefined variable: sql in D:\web\www\cs\login.php on line 8

代码如下
$username=$_POST['username'];
$password=$_POST['password'];
//$password=md5($password);
echo $username,$password;
include('db.php');
$sql='SELECT * FROM `user` WHERE username='$username' and password='$password' limit 1';
echo "$sql";
$query=mysql_query($sql);

?>


回复讨论(解决方案)

$sql=“SELECT * FROM `user` WHERE username='$username' and password='$password' limit 1”;

太大意了。。。。

还有就是想问 怎么写判断 如果数据库中没有传递来的数据  应该怎么写

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn