简体   繁体   English

列表框和 mysql 值

[英]Listbox and mysql value

I want to use "Listbox and mysql value" script one of my projects.我想在我的项目之一中使用“列表框和 mysql 值”脚本。 I have tables called Districts (40 Districts with districtid and districtname ) & Cities (100 cities with cityid , cityname and districtid ) and another table stores the house owner names and located district and city (this tables store the districtid value and cityid ).我有名为 Districts 的表(40 个 Districts 和districtid districtname和 Cities (100 个城市有cityidcitynamedistrictid ),另一个表存储房主姓名和所在的地区和城市(这个表存储districtid值和cityid )。

I have a php page, through that owners can change or edit their district or city anytime.我有一个 php 页面,通过该页面,业主可以随时更改或编辑他们的地区或城市。 In this page, I want to display the owners district and the city in listboxes and selected values should be displays corresponding to house owners data table.在这个页面中,我想在列表框中显示业主区和城市,并且选择的值应该显示对应于业主数据表。 How can I use your code for this?我怎样才能使用你的代码呢?

If i understand you question well, it's just about the logic:如果我理解你的问题,那只是逻辑:

  1. get owner city and district获取所有者城市和地区
  2. get districts, while looping through them to present then, check id with owner distruct id, if they match, set option to selected.获取地区,然后在遍历它们以呈现时,检查 id 与所有者 distruct id,如果它们匹配,则将选项设置为选中。
  3. same for city.城市也一样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM