我在通过 ajax 更新行时遇到问题,查询影响所有行而不是我给出的单个 id
这是我的模型类函数:
public function edit_season($data)
{
// echo $a = json_encode($data);
// echo $a->id;
// die();
$this->db->get_where('seasons', array('season_id ' => 11 ));
$query = $this->db->update('seasons',array('names ' => $data['name'] ));
if ($query)
{
return $query;
}
else
{
return FALSE;
}
}
Run Code Online (Sandbox Code Playgroud)
我还检查了从 ajax 获取的数据是否正确,但我猜查询存在一些问题,我什至对 id 值进行了硬编码,但它仍然更新所有名称而不是一个。
我正在按照 YT tuts 进行简单的注册,链接(https://www.youtube.com/watch?v=-OKrloDzGpU)在那里我有这个脚本,但app.js
出现错误
未捕获的类型错误:无法读取 HTMLInputElement.btnLogin.addEventListener.e (app.js:26) 处未定义的属性“signInWithEmailAndPassword”
// GET Users info
const txtEmail = document.getElementById('txtEmail');
const txtPassword = document.getElementById('txtPassword');
const btnLogin = document.getElementById('btnLogin');
const btnSignUp = document.getElementById('btnSignUp');
const btnLogout = document.getElementById('btnLogout');
//Add login event
btnLogin.addEventListener('click', e =>{
"use strict";
const email = txtEmail.value;
const pass = txtPassword.value;
const auth = firebase.value;
// Sign in
const promise = auth.signInWithEmailAndPassword(email,pass);
promise.catch(e => console.log(e.message));
});
Run Code Online (Sandbox Code Playgroud)
在第 26 行,我const promise = auth.signInWithEmailAndPassword(email,pass);似乎想念包含任何auth库,但我已将脚本包含在index.html
<!DOCTYPE html> …Run Code Online (Sandbox Code Playgroud)