成长值: 252 签到天数: 4709 天 [LV.Master]伴坛终老
|
发表于 2020/5/12 07:13
|
显示全部楼层
|阅读模式
|Google Chrome 81.0.4044.138 |Windows 10
php5升级前
- mysql_connect ($ip, $dbuser, $dbpass)or die("无法连接到数据库: ".mysql_error());
- mysql_select_db($dbname) or die(mysql_error());
- $md5pass = md5($pass);
- $checkuser = mysql_query("SELECT * FROM user WHERE name='$user' and password='$md5pass'");
- @$username_exist = mysql_num_rows($checkuser);
- if($username_exist >= 1)
复制代码
php7修改后
- $link = mysqli_connect ($ip, $dbuser, $dbpass, $dbname);
- if (mysqli_connect_errno($link))
- {
- echo "无法连接到数据库: " . mysqli_connect_error();
- }
- $md5pass = md5($pass);
- $checkuser = mysqli_query($link,"SELECT * FROM user WHERE name='$user' and password='$md5pass'");
- @$username_exist = mysqli_fetch_row($checkuser);
- if($username_exist >= 1)
复制代码
else之类语句完毕用完后记得随手关闭数据库
|
|