Home > Backend Development > PHP Tutorial > 【wamp】php链接MySQL

【wamp】php链接MySQL

WBOY
Release: 2016-06-06 20:29:46
Original
1187 people have browsed it

<code><?php $un=$_POST["userName"];
$pw=$_POST["passWord"];
$con=mysql_connect("localhost","root","");
mysql_select_db("szzoo");
$result=mysql_query("select passWord from login
					where userName=$un;"
);
 die(mysql_error());
if (mysql_result($result,0)==$pw)
{
	echo "sucess";
}
else
{
	echo "wrong";
}
mysql_close($con);
?></code>
Copy after login
Copy after login

Champ 'szzoo' inconnu dans where clause
我的MySQL里有szzoo库,其中也有login表
求大神帮忙啊。。。。

回复内容:

<code><?php $un=$_POST["userName"];
$pw=$_POST["passWord"];
$con=mysql_connect("localhost","root","");
mysql_select_db("szzoo");
$result=mysql_query("select passWord from login
					where userName=$un;"
);
 die(mysql_error());
if (mysql_result($result,0)==$pw)
{
	echo "sucess";
}
else
{
	echo "wrong";
}
mysql_close($con);
?></code>
Copy after login
Copy after login

Champ 'szzoo' inconnu dans where clause
我的MySQL里有szzoo库,其中也有login表
求大神帮忙啊。。。。

$result=mysql_query("select passWord from login where userName='".$un."'");

Related labels:
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