您好如何更新表中的活动列我的代码似乎无法正常工作
db.php中 `public function active($ table,$ id,$ fields,$ activecode){ $ set =''; $ x = 1;
img[0:128, 0:128] = list[1]
activate.php
`require_once'core / init.php';
foreach($fields as $name => $value){
$set .= "{$name} = ?";
if($x < count($fields)) {
$set .= ', ';
}
$x++;
}
$sql = "UPDATE {$table} SET {$set} WHERE id = {$id} AND activecode = {$activecode}";
if(!$this->query($sql, $fields)->error()){
return true;
}
//return false;
}`
激活链接 Activate.php活性= $ activecode&安培;。。。ID = $ ID
答案 0 :(得分:0)
$set .= "{$name} = '{$value}'";
此外&#34; $ this&#34;需要是一个mysqli对象,格式为:
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
$mysqli->query($sql);
if(!$mysqli->error){