-1

怎么了?

$db = JFactory::getDbo();
$query = $db->getQuery(true);        
$query = "SELECT jml.*,grkt.*,grk.*,jml.*"
."\n , FROM #__egerak_subutama AS grk"
."\n , inner join #__users AS jml ON jml.username = grk.username"
."\n , inner join #__egerak_kenyataan AS grkt ON grkt.kategori = grk.kategori"  
."\n , where actdate <= '$currYear- ". sprintf("%02d", $currMonth) . " - " . sprintf("%02d", $currDay). " '"
."\n , AND enddate >= '$currYear-". sprintf("%02d", $currMonth) . "-" . sprintf("%02d", $currDay). "'"
."\n , AND kodunit LIKE '%$ppdlms%'";

您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以在第 2 行 SQL=SELECT jml 的“FROM lpk_egerak_subutama AS grk , inner join lpk_users AS jml ON jml.username =”附近使用正确的语法。,grkt。,grk。,jml。, FROM lpk_egerak_subutama AS grk , 内连接 lpk_users AS jml ON jml.username = grk.username , 内连接 lpk_egerak_kenyataan AS grkt ON grkt.kategori = grk.kategori , 其中 actdate <= '2013- 04 - 15 ' , AND enddate >= '2013-04-15' 和 kodunit LIKE '%%'

4

1 回答 1

0
$db = JFactory::getDbo();
$query = $db->getQuery(true);        
$query = "SELECT jml.*,grkt.*,grk.*,jml.*"
."\n FROM #__egerak_subutama AS grk"
."\n inner join #__users AS jml ON jml.username = grk.username"
."\n inner join #__egerak_kenyataan AS grkt ON grkt.kategori = grk.kategori"  
."\n where actdate <= '$currYear- ". sprintf("%02d", $currMonth) . " - " . sprintf("%02d", $currDay). " '"
."\n AND enddate >= '$currYear-". sprintf("%02d", $currMonth) . "-" . sprintf("%02d", $currDay). "'"
."\n AND kodunit LIKE '%$ppdlms%'";

删除行首的所有逗号。您收到错误是因为逗号使 mysql 期望另一个项目选择不是 from 关键字。

于 2013-04-17T21:11:06.493 回答