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 />
我想把之前的密码都变成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]');
即使加引号也应该是双引号而不是单引号
------解决方案--------------------嗯, 引号的问题,把引号去掉