惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

W
WeLiveSecurity
T
The Exploit Database - CXSecurity.com
C
CXSECURITY Database RSS Feed - CXSecurity.com
S
Security @ Cisco Blogs
T
Threat Research - Cisco Blogs
TaoSecurity Blog
TaoSecurity Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
腾讯CDC
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
The Blog of Author Tim Ferriss
Microsoft Azure Blog
Microsoft Azure Blog
罗磊的独立博客
F
Full Disclosure
博客园 - 【当耐特】
C
CERT Recently Published Vulnerability Notes
Engineering at Meta
Engineering at Meta
Application and Cybersecurity Blog
Application and Cybersecurity Blog
T
Threatpost
I
Intezer
V2EX - 技术
V2EX - 技术
H
Hackread – Cybersecurity News, Data Breaches, AI and More
The Hacker News
The Hacker News
小众软件
小众软件
Google DeepMind News
Google DeepMind News
T
Tailwind CSS Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
B
Blog RSS Feed
Microsoft Security Blog
Microsoft Security Blog
N
News | PayPal Newsroom
MyScale Blog
MyScale Blog
AI
AI
Vercel News
Vercel News
Spread Privacy
Spread Privacy
美团技术团队
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
The GitHub Blog
The GitHub Blog
V
Vulnerabilities – Threatpost
Schneier on Security
Schneier on Security
Cyberwarzone
Cyberwarzone
G
GRAHAM CLULEY
Help Net Security
Help Net Security
Hacker News: Ask HN
Hacker News: Ask HN
Google DeepMind News
Google DeepMind News
MongoDB | Blog
MongoDB | Blog
L
LINUX DO - 热门话题
U
Unit 42
L
LangChain Blog
Recent Announcements
Recent Announcements

博客园 - Arcangel

又搬家了。。不过没有搬出博客园。。搬到JAVA板块去了。。 周记 转一篇文章~网站设计流程规范 - Arcangel - 博客园 进军xoops 感想~ php联动下拉菜单 无刷新 数据库 本人自己修改的,经测试可用 - Arcangel 编码改为utf8后出现的问题 关于mysql的乱码问题。非???错误 sql数据库上传 (弱智问题,我也弱智) 今天开发网站的时的一点小经验 关于php显示中文mysql数据的问题 关于css的层位置和层内元素的位置定义 发一个色彩学的转帖.相当有感触 太丑了~ 谈智慧.天才.和能力(二) 我很快乐~ 关于 首席网页设计师 晚茶~ 你赢一天~我赢一天~
说一下那个下拉菜单的id_2的含义
Arcangel · 2007-10-17 · via 博客园 - Arcangel

一开始我一直没有在意那个id_2的含义。最后还是出现了bug.即如果父类没有子类的情况下,下一个父类的子类的值会成为这一个父类的值,造成错位。

原因是while这个语句,他把所有父类的值取出来,然后把id一一传入province_id.当然也把没有子类的父类给传了进去

然后在子类的whlie循环的时候,由于有些父类没有子类,造成子类根据父类id查找不到相应的值,就造成while里面的条件句mysql_fetch_array的值为false.不执行该循环,直接执行下次循环,也就出现了错位的现象。

解决的方法就是设置id_2这个字段,有子类的父类这个id_2字段将设置为1,而没有子类的字段设置成0。这样就不会搜索到那些没有子类的父类了,顺序也就正常了。当然在添加和删除父类和子类的时候需要进行判断,如果该父类没有子类的话就将id_2设置成0,如果有的话就设置成1。具体方法大家应该都会。数据库的操作而已。