【发布时间】:2011-06-27 16:04:16
【问题描述】:
我有两个表国家,其字段的位置是
_countries
countryid(Primary Key)
countryname
_location
locationid(primarykey)
locationname
countryid(Foreign key from countries table)
每件事都是使用 JavaScript、AJAX 和 php 完成的,当用户从下拉列表中选择一个国家/地区时,每个国家/地区的位置将被替换,但 mysql 查询不起作用 我正在使用以下查询
$sql="SELECT _location.locationname, _countries.countryname FROM _location
INNER JOIN _countries ON _location.countryid='".$q."'";
//$q is the countryid selected from drop down list i got it through javascript and php
下拉列表是从国家表中填充的 我的问题是当用户从下拉列表中选择国家名称时 mysql 查询根据每个国家/地区名称获取位置名称并显示这样的数据
||Location name||Country Name||
Islamabad Pakistan
Karachi Pakistan
【问题讨论】:
标签: php mysql drop-down-menu