我正在处理一个Extjs应用程序,我需要得到两个select查询的结果,在Json中对结果进行编码,然后将包含这些结果的存储绑定到一个gridview。我有一个gridview whith两列,第一个是“name_scope”,第二个是应该包含作用域的值(范围可以有多个值)的组合框。所以我在mySQL中创建了两个表,“scope”和“scope_value”,我想将scope_name从“scope”表绑定到我的第一列,然后从“scope_value”表中将值赋给combo列。两个MySQL SELECT查询在一个
我不认为这是一个好主意,以两家店的这件事情,所以我想仅做一个PHP脚本,将包含这两个查询:
SELECT name_scope FROM scope
和
SELECT value FROM value_scope WHERE name_scope = "'. $name_scope .'"';
这些都是我的表:
create table scope (name_scope varchar(50) not null primary key, description varchar(100));
create table value_scope (id_value int not null primary key AUTO_INCREMENT,name_scope varchar(50), value varchar(100),
foreign key (name_scope) references scope(name_scope) on delete cascade);
我的GridView:
{
xtype: 'container',
id : 'grid_container',
anchor: '100%',
forceFit: true,
items: [{
xtype: 'gridpanel',
id: 'scope_grid',
layout : 'fit',
frame: true,
columnLines: true,
iconCls: 'icon-grid',
title: 'Prod/Rel added',
store: 'GetScopeData',
columns: [{
id: 'n_scope',
text: 'Scope',
flex: 1,
sortable: true,
dataIndex: 'name_scope'},
{ header: 'Product Release',
width: 220,
fixed: true,
hideable: false,
dataIndex: 'value',
editor: {
xtype: 'combobox',
displayField: 'value',
valueField: 'value',
mode: 'local',
editable : false,
typeAhead: false,
triggerAction: 'all',
lazyRender: true,
emptyText: 'Select action',
listClass: 'x-combo-list-small'
}}
]}
我的php脚本应该是什么样子? 请任何帮助,将不胜感激。