一般的后台管理别表都会有排序功能
思路:循环得到多个update语句,执行
html
<td><input name="listorders[{$vo.id}]" class="input input-order" type="text" size="5" value="{$vo.sort}"></td>
controller
//热搜排序
public function listorders()
{
$listorders = I('post.listorders', '');
$sql = "";
foreach ($listorders as $key => $vo) {
$sql .= "update rs_rubbish_keywords set sort=$vo where id =$key;";
}
if (M()->execute($sql) !== false) {
$this->success("排序更新成功!");
} else {
$this->error("排序更新失败!");
}
}