1
我試圖把一個SQL字符串放在一起Joomla - >試圖連接到一個MS SQL Server實例,並且我有下面的語法。我試圖使用echo $query;
在屏幕上顯示字符串,但查詢不顯示在屏幕上。Joomla查詢連接字符串
什麼是正確的語法使用JDatabase
串起來呢?
$query->select('select empfirstname, emplastname, empaddress, empcity, empstate');
$query->from($db->quoteName('[HiringInfo]'));
$query->where("hiredate IS NOT NULL");
$dropdownlistDates = $db->quoteName('hiredate');
if (isset($sd) && isset($ed))
{
$query->where("$dropdownlistDates >= " . $db->quote($sd), 'AND');
$query->where("$dropdownlistDates <= " . $db->quote($ed));
}
elseif (isset($datecriteria))
{
if ($datecriteria != 15
&& $datecriteria != 30
&& $datecriteria != 45)
{
return null;
}
$min_date = DateAdd(day, $datecriteria * -1, getdate());
$query->where("$dropdownlistDates >= " . $db->quote($min_date), 'AND');
$query->where("$dropdownlistDates <= " . $db->quote(getdate()));
}
這是爲mssql - 現在會更新問題。 – BellHopByDayAmetuerCoderByNigh
好的,我編輯我的答案 – Rinos