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

WBOY
Release: 2016-06-23 14:00:23
Original
933 people have browsed it

网页提示 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”;

太大意了。。。。

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

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template