SQL密码MD5加密有关问题

WBOY
Release: 2016-06-13 11:54:36
Original
924 people have browsed it

SQL密码MD5加密问题

<br />$sql="select stu_id,stu_password from studentPwd2";<br />$res=sqlsrv_query($conn,$sql);<br />while($r=sqlsrv_fetch_array($res))<br />{<br />	$b=md5('$r[1]');<br />	echo $r[1]."对应MD5".$b."<br />";<br />	$sql2="update studentPwd2 set stu_password='".$b."' where stu_id='".$r[0]."'";<br />	echo $sql2."<br />";<br />	sqlsrv_query($conn,$sql2);<br />}<br />
Copy after login

我想把之前的密码都变成MD5加密的,然后就这样子,为什么密码都变成一样的了
123456对应MD5ab71f115b2cd70037a03031f9827b924
update studentPwd2 set stu_password='ab71f115b2cd70037a03031f9827b924' where stu_id='ID1'
111111对应MD5ab71f115b2cd70037a03031f9827b924
update studentPwd2 set stu_password='ab71f115b2cd70037a03031f9827b924' where stu_id='ID2'
------解决方案--------------------
$b=md5('$r[1]');
即使加引号也应该是双引号而不是单引号
------解决方案--------------------
嗯, 引号的问题,把引号去掉

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