一、PHP/MySQL编程 2)同样上述内容管理系统:表comment记录用户回复内容,字段如下 文章id 文章标题 点击量 回复数量
用一个SQL语句完成上述查询,如果文章没有回复则回复数量显示为0 3) 上述内容管理系统,表category保存分类信息,字段如下 drop table if exists Comment; drop table if exists category; drop table if exists message; /*==============================================================*/ /* Table: Comment */ /*==============================================================*/ create table Comment ( comment_id int unsigned not null, id int unsigned not null, comment_content text, primary key (comment_id) ) type = InnoDB; /*==============================================================*/ /* Table: category */ /*==============================================================*/ create table category ( category_id int not null AUTO_INCREMENT, category_name varchar(40) not null, primary key (category_id), key AK_pk_category_id (category_id) ) type = InnoDB; /*==============================================================*/ /* Table: message */ /*==============================================================*/ create table message ( id int not null, title varchar(120) not null, content text not null, category_id int unsigned, hit int unsigned, primary key (id) ) type = InnoDB; select A.id,A.title,A.hits,IFNULL(B.num,0) from message A left join (select id,count(*) as num from comment B group by id) B on A.id=B.id order by B.num desc;
<html> <head><title>JS打印</title></head> <body> <form> <select id="category" name="category"> <?php mysql_connect("localhost","root","") or die("db conn error:".mysql_error()); mysql_select_db("phpinterview") or die("db error".mysql_error()); $result=mysql_query("select category_id,category_name from category"); while($row=mysql_fetch_array($result)) { echo "<option value='".$row["cateogry_id"]."'>".$row["category_name"]."</option>"; } ?> </select> </form> </body> |
随笔 - 1330
文章 - 1
评论 - 378
阅读 -
482万
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)