【发布时间】:2016-01-08 07:44:30
【问题描述】:
我正在开发一个 Joomla 3 组件,我正在尝试使用 Joomla 框架类从数据库中选择数据。我收到一个错误不是唯一的表/别名。可能是什么原因?
代码片段...
$app = JFactory::getApplication();
$job_id = JRequest::getVar('Jobid', null);
try {
$db = JFactory::getDbo();
$query = $db->getQuery(true);//Here Was The Problem
$query->select(array('A.state AS approval_state', 'A.*', 'B.*', 'C.district_name', 'D.educational_qualification', 'E.current_job_status'))
->from($db->quoteName('#__pes_job_provider_request_cv_info') . 'AS A')
->join('LEFT', '#__pes_jobseeker_profile AS B ON B.jobseeker_profile_id = A.jobseeker_profile_id')
->join('LEFT', '#__pes_district AS C ON C.district_id = A.district_id')
->join('LEFT', '#__pes_highest_educational_qualification AS D ON D.highest_educational_qualification_id = B.highest_educational_qualification_id')
->join('LEFT', '#__pes_current_job_status AS E ON E.current_job_status_id = B.current_job_status_id')
->where($db->quoteName('A.job_order_registration_id') . ' = ' . $db->quote($job_id))
->order('B.name_in_full ASC');
$db->setQuery($query);
$results = $db->loadObjectList();
谢谢。
【问题讨论】:
-
你是如何从数据库中获得
select的?请在您的问题中包含该代码 sn-p。 -
刚刚添加了代码片段
标签: mysql database joomla3.0 joomla-extensions