MySQL操作执行成功,但没有返回值?

Anew_G Anew_G 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
在MySQL console中执行:


mysql>update `1001` set finish=0 where sid=94664;
Query OK,1 row affected (0.07 sec)
Rows matched:1 changed:1 warnings:0



php中的语句:



$tid="`".$_COOKIE['uid']."`";
$which="finish=1";
$where="sid=".$sid;
$db=new Mysql("localhost","root","","members_check","","UTF8");
$db->connect();
$result=$db->update($tid,$which,$where);
echo $result;
//if($result){echo 0;}else{echo 1;}



js那里返回来的就是空,什么都没有。用下面那个if语句返回不了0。但是数据库里全部操作成功。

附上封装的函数:



public function query($sql) {
if ($sql == "") {
echo "SQL语句为空";
}
$this->sql = $sql;
$result = mysql_query($this->sql, $this->conn) or die('faill'.mysql_error());
$this->result = $result;
return $this->result;
}

public function update($table, $mod_content, $condition, $url = '') {
$result=$this->query("UPDATE $table SET $mod_content WHERE $condition");
return $result;
}


...全文
评论 16
收藏 已收藏
分享
返回顶部
Anew_G
基础编程 21,889 成员 140,329 内容