Mysql语句报错Unknowncolumninfieldlist

更新时间:2023-07-07 16:58:42 阅读: 评论:0

// 拼装sql语句,重点在于--->'".$urname."'
dnfg把握机遇$this->sql = "inrt into $this->table (urname, password) values ('".$urname."', $password)";
return $this;
}
// 删除数据
public function delete($id)
{
$this->action = 'other';
$this->sql = "delete from $this->table where id = $id";
return $this;
}
美少女的谎言第3季/
/ 修改数据
public function update($id, $urname, $password)
pocket full of sunshine{
$this->action = 'other';bleep
$this->sql = "update $this->table t urname='".$urname."', password=$password where id = $id";        return $this;
}
// 之所以名称不⽤query是为了仍然可以使⽤mysqli类的query⽅法执⾏sql
public function query2()
{
// 执⾏语句
$result = $this->query($this->sql);
宁波雅思培训保过班
// 判断⽤户是什么操作
if ($this->action == 'lect') {
fund$data = [];
// 解析查询数据
foreach ($result as $key => $value) {
$two_data = [];
foreach ($value as $two_key => $two_value) {
$two_data[$two_key] = $two_value;
ixo
}
hudson
$data[$key] = $two_data;
}
return $data;
} el {
if($result) {
return $result;
} el {
// 输出语句错误信息
echo $this->error;
return fal;
}
}
}
}
// 建⽴与数据库的连接
$db = new MysqliClass('studymysqli');
cair
// 设置要操作的表
$db->table = 'mysqli_class';
// 1. 查询数据
// $result = $db->lect()->query2();
// var_dump($result);
// 2. 添加数据,⽤时间戳替代密码,⽤来判断是否成功添加
// $result = $db->inrt('测试姓名', time())->query2();
// var_dump($result);
/
/ 3. 修改数据,
// 参数解释,唯⼀标识ID, ⽤户名称urname, ⽤户密码password
// $result = $db->update(2, '修改⽤户名称', time())->query2();

本文发布于:2023-07-07 16:58:42,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/90/170142.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:数据   语句   解释
相关文章
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图