Home > Backend Development > PHP Tutorial > SQL密码MD5加密问题

SQL密码MD5加密问题

WBOY
Release: 2016-06-23 13:59:00
Original
1063 people have browsed it

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

这里。。。。应该把引号去掉。。。最后结果是‘$r[1]'这7个字符的MD5。。。。

$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