我在我的WHERE語句中有兩個變量。我似乎不能用空格分隔它們,所以我最終得到了語法錯誤。謝謝您的幫助。無法在我的SQL語句中獲得空格
(我用笨)
BTW我已經嘗試設置$空間變量,並把空間之前,並設置兩個變量後,並在SQL。
ERROR
錯誤編號:1064
您的SQL語法錯誤;請檢查與您的MySQL服務器版本對應的手冊,以找到在第2行'source_adusers.ad_account ='Wolfs,Marc'GROUP BY rollout_systems.eam_user LIMIT'附近使用的正確語法012 *如從rollout_systems系統LEFT JOIN source_adusers ON rollout_systems.EAM_User = source_adusers.ad_account WHERE rollout_systems.scope_ID = 3-和source_adusers.ad_account = 「沃爾夫斯,馬克」 GROUP BY rollout_systems.eam_user LIMIT 0,50
行號:330
PHP
if ($this->session->userdata('scopeId') != NULL) {
$where1 = 'WHERE rollout_systems.scope_ID = '. $this->session->userdata('scopeId') . '';
} else {
redirect('/headquarters/home');;
}
if ($search) {
$where2 = ' AND rollout_systems.sys_name ="'.$search.'"';
} else {
$where2 = '';
}
$query = $this->db->query('SELECT * FROM rollout_systems LEFT JOIN source_adusers
ON rollout_systems.eam_user = source_adusers.ad_account '. $where1 .''. $where2 .' GROUP BY rollout_systems.sys_name LIMIT '.$limit.',50');