session_start();
include "../inc/chec.php";
include "../conn/conn.php";
$sqlstr = "select * from tb_controller(id,mana_pwd) where id = ".$_SESSION['id']." and mana_pwd = '".$_POST['old_pwd']."'";
$result = mysql_query($sqlstr,$conn);
if($rows = mysql_fetch_row($result)){ -----------------------------------------------------------第七行
$modsql = "update tb_controller set mana_pwd = '".$_POST['new_pwd']."' where id = ".$_SESSION['id'];
//echo $modsql;
if(mysql_query($modsql,$conn)){
echo "<script>alert('密码修改成功');history.go(-1);</script>";
}else{
echo "<script>alert('密码修改失败');history.go(-1);</script>";
}
}else{
echo "<script>alert('密码错误,请重新输入!');history.go(-1);</script>";
}
?>
Warning: mysql_fetch_row() expects parameter 1 to be resource, boolean given in chk.php on line 7
答案:2 悬赏:10 手机版
解决时间 2021-03-09 17:55
- 提问者网友:送舟行
- 2021-03-09 00:58
最佳答案
- 五星知识达人网友:过活
- 2021-03-09 02:03
session_start();
include_once '../inc/chec.php';
include_once '../conn/conn.php';
function Alert( $msg = '' ) {
echo '<script>alert("' . $msg . '");history.go(-1);</script>';
die;
}
$sqlstr = 'Select id, mana_pwd from tb_controller where mana_pwd = \'' . $_POST['old_pwd'] . '\' and id = ' . $_SESSION['id'];
$result = mysql_query( $sqlstr, $conn ) or Alert( mysql_error() );
mysql_num_rows( $result ) or Alert('密码错误,请重新输入');
$modsql = 'Update tb_controller set mana_pwd = \'' . $_POST['new_pwd'] . '\' where id = ' . $_SESSION['id'];
Alert( mysql_query( $modsql, $conn ) ? '密码修改成功' : '密码修改失败,错误信息是:' . mysql_error() ); 一、Sql语句语法错误
二、if语句语法错误
include_once '../inc/chec.php';
include_once '../conn/conn.php';
function Alert( $msg = '' ) {
echo '<script>alert("' . $msg . '");history.go(-1);</script>';
die;
}
$sqlstr = 'Select id, mana_pwd from tb_controller where mana_pwd = \'' . $_POST['old_pwd'] . '\' and id = ' . $_SESSION['id'];
$result = mysql_query( $sqlstr, $conn ) or Alert( mysql_error() );
mysql_num_rows( $result ) or Alert('密码错误,请重新输入');
$modsql = 'Update tb_controller set mana_pwd = \'' . $_POST['new_pwd'] . '\' where id = ' . $_SESSION['id'];
Alert( mysql_query( $modsql, $conn ) ? '密码修改成功' : '密码修改失败,错误信息是:' . mysql_error() ); 一、Sql语句语法错误
二、if语句语法错误
全部回答
- 1楼网友:迷人又混蛋
- 2021-03-09 03:27
应该是你那个mysql_query()返回的是false,没查询对,所以$result结果是false,mysql_fetch_rows输入参数需要一个resource也就是一个正确的查询返回的源。
所以你需要多一个判断的if语句。
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯