时间:2021-07-01 10:21:17 帮助过:18人阅读
实现新闻的上移下移功能 query("select * from `article` where `weight` > '$_GET[weight]' order by `weight` asc limit 1"); if($conn->db_num_rows(query)>0){ $rows=$conn->fetch_array($query); $conn->query("update `article` set `weight`='$rows[weight]' where `weight`='$_GET[weight]'"); $conn->query("update `article` set `weight`='$_GET[weight]' where `ID`='$rows[ID]'"); }else{ echo ""; } }else if($_GET["move"]=="down"){ //获取下一条新闻信息 $query=$conn->query("select * from `article` where `weight` < '$_GET[weight]' order by `weight` desc limit 1"); if($conn->db_num_rows(query)>0){ $rows=$conn->fetch_array($query); $conn->query("update `article` set `weight`='$rows[weight]' where `weight`='$_GET[weight]'"); $conn->query("update `article` set `weight`='$_GET[weight]' where `ID`='$rows[ID]'"); }else{ echo ""; } } } ?>
ID | 标题 | 移动 |
?weight=&move=up">上移/?weight=&move=down">下移 |
这个……CI的官方文档里有完整示例看过就知道怎么分了
看过文档,知道怎么弄了