使用where子句创建自定义视图时出现问题

时间:2015-06-30 10:30:05

标签: php mysql

我使用PHP作为数据库的前端创建了一个页面。它运行正常,我在MYSQL中使用WHERE子句创建了一个查询,它运行得很好但是在PHP上,它不允许我在自定义视图中保存该查询。

我需要该查询,因为我希望最终用户输入团队名称以获取他们所需团队的列表。但是在PHP上,我无法做到这一点。

我使用PHP Maker创建前端。

以下是我的查询的SQL代码

SELECT
emp_details_ees.Employee_Code,
emp_details_ees.Employee_Name,
post.Emp_Post,
designation.Employee_Designation,
team.Emp_Team,
base_station.Base_Station,
region.Region,
zone.Zone,
emp_details_ees.Employee_Company_Number,
emp_details_ees.Employee_Comapny_Email,
`status`.Emp_Status,
emp_details_ees.Employee_Personal_Address
FROM
base_station
INNER JOIN emp_details_ees ON emp_details_ees.Employee_Base_Station = base_station.basestation_id
INNER JOIN post ON emp_details_ees.Employee_Post = post.emppost_id
INNER JOIN designation ON emp_details_ees.Employee_Designation = designation.empdesignation_id
INNER JOIN region ON emp_details_ees.Employee_Region = region.region_id
INNER JOIN `status` ON emp_details_ees.Employee_Status = `status`.empstatus_id
INNER JOIN team ON emp_details_ees.Employee_Team = team.empteam_id
INNER JOIN zone ON emp_details_ees.Employee_Zone = zone.zone_id
WHERE
`status`.Emp_Status = 'Active' AND team.Emp_Team = [$Emp_Team]
ORDER BY
base_station.station_sortid ASC,
designation.designation_sortdid ASC;

如果你能帮助我清除困惑。

1 个答案:

答案 0 :(得分:0)

在WHERE子句

中将[$ Emp_Team]更改为{$ Emp_Team}